Questions tagged [modal-dialogs]

Use it for questions about modal popup dialogs, including the overlay implemented in the Drupal 7 Overlay module.

Filter by
Sorted by
Tagged with
0 votes
1 answer
498 views

How do I make links from views to be opened in modal popups without adding custom rewrite?

I was trying to find if there is a way to avoid writing custom rewrite for links to open in modal popups from a view. Here is what I am rewriting a custom field for doing this now. <a href="...
0 votes
1 answer
692 views

How to display an overlay image in modal window (Colorbox) upon hover

I have a series of images set up to display in modal lightbox-type windows – specifically, using the Colorbox module. The goal is for each image to be paired with a companion graphic overlay which is ...
0 votes
1 answer
726 views

Use ajax to save modal / dialog form instead of page reload

I'm looking for a way to save modal & dialog forms through ajax instead of redirecting the user after the form submit. Ajax is quite unknown territory to me. I've found several interesting topics ...
2 votes
1 answer
951 views

Modal form file upload is not working

I am trying to use ctools modal form to edit node form. This form is containing a file field. The Form is rendering properly. When I try to upload a file on clicking upload button, file field has been ...
0 votes
1 answer
635 views

How to trigger a popup window/overlay in my module?

I am stuck in my project. I am working on a module for account management page. When the user update their billing address, a service call will be triggered to send request to a third party API to get ...
0 votes
1 answer
544 views

Is it possible to show only node contents in shadowbox pages?

I'm looking for a method to display content (nodes) in a shadowbox overlay without any blocks or menus around it. even if the user is logged in. Has someone an Idea how to do this are there even ...
2 votes
2 answers
1k views

How to close the overlay after form submission

In order to be able to quickly edit Fullcalendar items, I altered the node edit form of the specific content type so the events are saved with AJAX and the page doesn't have to reload. However, I don'...
1 vote
1 answer
2k views

How do I display a modal dialog on page load, with working title and dialog options, using OpenModalDialogCommand?

I'm trying to display a modal dialog containing some simple markup on page load. I'm getting the expected markup to load, and the dialog appears. However, the dialog title always displays "...
10 votes
1 answer
1k views

How do I theme a modal popup?

How can I style Drupal 8 modal window to achieve Instagram style and behaviour? I'm creating modal through extending ControllerBase class, thus have full control of content. However I can't figure it ...
3 votes
1 answer
455 views

Why does "Cancel People Account" not work?

I have Drupal 7 with Devel installed running over PHP internal server and MySQL. All user operations work correctly except Admin>People>Cancel Account operation. This leads to the overlay Add User ...
2 votes
1 answer
805 views

Custom Submit Callback only triggering when Form is Valid when in Dialog

I'm trying to create a node in a dialog with the following link: Enter the title of a registration form or <a class="use-ajax" data-dialog-options="{&quot;width&quot;:...
2 votes
2 answers
1k views

How can I add animation/fade to modal/dialogue boxes?

The current state of a modal/dialog opening in Drupal 8 (and 7 for that matter) is pretty clunky from a user experience perspect. Leveraging some type of animation/fade would really enhance the ...
1 vote
1 answer
92 views

Can't access data posted from Dialog.ajax to dialog box

I am opening a simple dialog box from Ajax, using the following code- var exportActionDialog = Dialog.ajax({ dialog: dialogSettings, dialogType: 'modal', type: 'POST', url: '/web/admin/crm/...
1 vote
2 answers
199 views

Modal does not handle errors on login

I have used 'use-ajax' class to render login form in a modal. I want to handle validation errors on same modal without closing it. On successful login it is redirecting correctly, but when an error ...
1 vote
1 answer
294 views

Modal form opened from modal form doesn't submit

I have a user form mode (like node view mode except for forms) opened in a modal. When this form is submitted the user entity is updated and the modal is closed. This works fine. I now want to extend ...
1 vote
1 answer
2k views

Custom form calls different form in modal, submit/ajax callback of second form not called

I created 2 forms: dms_gift_voucher/src/Form/GiftVoucherForm.php ... /** * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state) { .... $...
0 votes
0 answers
82 views

How to change markup of modal dialogs

A modal form is defined in openModalForm(), and the modal form is called by $form['open_modal']. public function openModalForm() { $response = new AjaxResponse(); // Get the modal form using the ...
0 votes
2 answers
1k views

Force page open in overlay

I want to force admin pages open only and only in overlay. As you know if a link with an admin path is clicked it opens in overlay (if enabled). But if you write the URL to the browser, or use some ...
0 votes
2 answers
3k views

How can I open a node edit form in an overlay (modal window)?

I have a view with nodes of type 'tasks'. I want to easily view and edit these tasks by using a minimized overlay. When I click on a task title in the view, it needs to open in an overlay. In Drupal 7 ...
1 vote
1 answer
137 views

Why is ScrollTopCommand not working?

I have a node edit form which I submit via ajax and then opens a modal doing this: $form['actions']['submit'] = array_merge($form['actions']['submit'], [ '#value' => t('Get quote'), '#...
2 votes
0 answers
376 views

Refresh a form with Ajax after closing a Dialog

So I have a custom form in which I display a list of entities. Below that list, I added an “Add More” link which opens a Dialog. When I close (or submit) the Dialog, I want the list of entities to be ...
0 votes
0 answers
276 views

Action of webform displayed in modal opened by OpenModalDialogCommand in AjaxResponse

I'm trying to open a webform in a modal by using OpenModalDialogCommand in an AjaxResponse like this. in buildForm method, I'm specifying AJAX callback like this: $form['actions']['submit'] = [ '#...
0 votes
1 answer
351 views

Refresh ( or reopen) a Dialog (meida browser) with javascript

I have a media field, which when the user clicks on it, the media selector will open with the list of media. I have a custom button there which do some ajax calls at the end I want to refresh the ...
-3 votes
1 answer
59 views

HtmlRouteProvider not found error [closed]

I've just started using the Modal module version 4.1.15 and haven't made any changes to the file structure, now after clearing the cache I get this error: Error: Class 'Drupal\modal_page\Entity\...
0 votes
1 answer
559 views

Using jQuery Tools

I have looked online to see if it is possible to use jQuery Tools 1.2.7 with Drupal 7. I see that there is a defunct project that attempted to use it in Drupal 6 but nothing for Drupal 7. I tried ...
1 vote
1 answer
187 views

What is the correct way to set language used by a modal form?

I have a button linked through a controller to open a custom form in a modal: The controller callback is: /** * Callback for opening the modal form. */ public function openShareLinkModalForm(...
1 vote
0 answers
183 views

Ajax drupal dialog doesn't respect dialog-option

I have: $options['attributes']['class'][] = 'use-ajax'; $options['attributes']['data-dialog-type'] = 'modal'; $options['attributes']['data-dialog-options'] = json_encode([ 'width' => 375, ]); ...
0 votes
1 answer
39 views

Drupal modal does not render remote forms (Mautic)

I'm trying to embed Mautic forms in my drupal site. I created a controller pointing to '/mautic-form` and in the twig template I have this: <script type="text/javascript" src="//...
0 votes
0 answers
148 views

Is there any way to add JS to form only when loaded using ajax-api in modal?

I have one page on which there is a button. On click of that button I am opening a webform in modal popup (Ajax dialog). What I need is to add a GA script to the form. I have tried using ...
-2 votes
1 answer
944 views

How to open a form in modal from controller while redirect

I can open a form in modal when click on a link (and there are lot of examples in the net as well). What I like to do: When some one go to a url in browser or redirect to a url, it will open a dialog/...
2 votes
1 answer
316 views

Looking for suggestions on AJAX-base update to view

I have a requirement that I'm not sure how to go about implementing. The flow goes something like this: User clicks button: share your update Popup window opens User fills in form and clicks Save ...
0 votes
1 answer
60 views

Entity Browser Modal closes on Exposed Filter Submit Button

I've set up a commerce shop that uses Entity Browser to select product images. I set up a view to display the selectable images which has an exposed filter for the filename, so the user can search for ...
3 votes
2 answers
3k views

Add event listener to modal close

In Drupal we can open a modal is two ways, either with HTML: <a class="use-ajax profile-page-link" data-dialog-type="modal" href="/node/1" data-dialog-options="{&...
0 votes
0 answers
209 views

Display constraint error in the ajax modal window

From within a form, I have added a link which open a modal form in which I can edit a Paragraph. Here is the code for this link: $form['my_modal_edit_form'] = [ 'title' => $this->t('Edit'), '...
1 vote
1 answer
1k views

Display status message after submitting modal popup form

Ok so i have a custom entity and want to display a custom delete form. Have created the Route and everything works except for Drupal messenger displaying status message after submission, even after a ...
1 vote
0 answers
92 views

Dynamically added params for a link not found when the link is opened with a dialog

I do not know if it has to do with JavaScript/Ajax or with Drupal's dialog modal. Any advice is appreciated. On our project we open several links in a modal. For this the link is rendered in the ...
-1 votes
1 answer
399 views

Running JQuery code in Admin Overlay

I have an overlay module installed which allows my admin to open in an Overlay (Jquery Pop Up) I want to run a specific JQuery code whenever admin page opens in an overlay. How can I do that?
0 votes
0 answers
811 views

OpenModalDialogCommand without site configuration permission

I have a custom module in Drupal 8.9.9 to open a form in a modal dialog with OpenModalDialogCommand. The custom_modal.routing.yml file has: custom_modal.open_modal_form: path: '/modal_form/{title}/{...
0 votes
1 answer
215 views

AJAX Modal Form

I created a modal form with Ajax: <?php /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the ...
1 vote
1 answer
794 views

Show node links in modal buttonpane

I want to show some node fields in buttonpane when I open node in modal. As far as I know, it will automatically show there inputs with type submit and links with class button, but I added class ...
3 votes
1 answer
3k views

Open ajax dialog with JavaScript

By adding use-ajax to a link we can open a modal using the Drupal ajax library as per the docs. E.g. <a class="use-ajax" data-dialog-options="{&quot;width&quot;:400}&...
2 votes
2 answers
1k views

Using attach_library in a modal

For ref, I'm working on https://www.drupal.org/project/focal_point/issues/3162218 I have a twig file that handles the contents of a modal window and I want to load a particular CSS file whenever this ...
1 vote
1 answer
161 views

Form in modal dialog: Template suggestions have weird random suffix

My custom module has the following form route in mymodule.routing.yml: library_assets.add_asset_to_slideshow_modal: path: 'library/add-to-slideshow-modal/{library_asset_nid}' defaults: _form: ...
0 votes
0 answers
280 views

Replace the default modal with a different one

I want to replace Drupal 8 default modal with MDB. How I can do it? Should I unload default library for modals and load new one? Any idea?
0 votes
1 answer
90 views

Popups & colorbox issues in Chrome

Hoping for some guidance here. Sometime in the past few weeks, my inline modal popups stopped working in Chrome. I had Colorbox set up at the time, both hand coded inline links and views colorbox ...
1 vote
1 answer
225 views

How do form #states interact with dialog action buttons, if at all?

A dialog can be fired by a link formatted as such: <a class="use-ajax" data-dialog-options="{&quot;width&quot;:400}" data-dialog-type="modal" href="/some/path"> Some ...
3 votes
1 answer
3k views

How do I theme the core modal with twig?

Drupal 8 comes with built in modals. This works: <a href="/node/11" class="use-ajax" data-dialog-type ="modal">modal</a> How can I style that modal using twig, to add new classes to the ...
0 votes
0 answers
2k views

Programmatically get the current url of the page from where a Webform in a dialog has been loaded

The below link will open the webform (contact) in a dialog: <a href="/form/contact" class="btn btn-success webform-dialog webform-dialog-normal">Contact</a> this same link has been ...
1 vote
1 answer
400 views

How to have a dialog box displayed automatically when a page is reached without having to click the link?

Using Dialog API and advice from @leymannx, I added this link to a node (node99): <a class="use-ajax" data-dialog-options="{&quot;width&quot;:600}" data-dialog-type="modal" href="/node/...
2 votes
1 answer
597 views

How to populate an Entity Reference field from a modal AjaxResponse?

I have an entity ref autocomplete field (reference to bundle A) in one of my bundles (bundle B). I want to add a button below this field which will open a modal for a bundle A create form. This code ...