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
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/...
ilechcod's user avatar
  • 123
1 vote
1 answer
292 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 ...
liquidcms's user avatar
  • 1,278
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 ...
shibasaki_stack's user avatar
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'), '#...
liquidcms's user avatar
  • 1,278
2 votes
0 answers
375 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 ...
JFC's user avatar
  • 521
0 votes
0 answers
275 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'] = [ '#...
Miloš Kroulík's user avatar
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 ...
Yuseferi's user avatar
  • 22k
-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\...
Riley Lutz's user avatar
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(...
liquidcms's user avatar
  • 1,278
0 votes
1 answer
497 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="...
anoopjohn's user avatar
  • 938
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, ]); ...
Letharion's user avatar
  • 27.5k
0 votes
1 answer
725 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 ...
Apoc's user avatar
  • 92
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="//...
rpayanm's user avatar
  • 3,601
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 ...
madhukar's user avatar
-2 votes
1 answer
943 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/...
Md. Shafiq Hossain's user avatar
2 votes
1 answer
804 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;:...
Chris Happy's user avatar
  • 1,897
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 ...
Berry Dingle's user avatar
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'), '...
Baud's user avatar
  • 532
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 ...
Key's user avatar
  • 304
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 ...
Tobias Krause's user avatar
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 "...
WRD's user avatar
  • 307
0 votes
0 answers
810 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}/{...
GJW80's user avatar
  • 55
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 ...
mak arthur's user avatar
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) { .... $...
mgoubert's user avatar
  • 365
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 ...
mixerowsky's user avatar
  • 1,581
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="{&...
Felix Eve's user avatar
  • 6,453
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}&...
Felix Eve's user avatar
  • 6,453
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 ...
bleen's user avatar
  • 1,500
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: ...
Travis Miller's user avatar
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?
mixerowsky's user avatar
  • 1,581
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 ...
tonka69's user avatar
  • 21
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 ...
Mrweiner's user avatar
  • 1,921
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 ...
user avatar
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 ...
nhck's user avatar
  • 156
1 vote
1 answer
398 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/...
gbmapo's user avatar
  • 1,066
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 ...
liquidcms's user avatar
  • 1,278
0 votes
1 answer
642 views

Creating ajax modal from event

Here's the deal. I want to create a modal popup when an add to cart event is triggered. I've got the event working just fine but can't seem to get the ajax to work properly. What I'm working off of ...
Derek C.'s user avatar
  • 195
1 vote
1 answer
904 views

How to get node title using this query on template?

Im building a custom filter in Drupal 8 based on some queries. I got this already, here im filtering by values on body: $query = db_select('node__body', 'n') ->fields('...
lucasvm1980's user avatar
1 vote
1 answer
47 views

Issue regading custom form

https://wineshipinsure.com/newdrupal/ex81/helloform I have been using the custom form and followed all the process for creating the custom form but my form is not working and every time getting page ...
user98094's user avatar
0 votes
1 answer
338 views

How to open a link in ctools modal by clicking a views row in table format?

I want to open a page in ctools modal. This works for me. <a href="/my-page/nojs" class="ctools-use-modal">Click</a> But now I want to open the same page in ctools modal by clicking the ...
Ahmad's user avatar
  • 2,835
0 votes
0 answers
95 views

SweetAlert doesn't display content markup

The SweetAlert modal is not displaying the content as passed in the option array when returning a response from the controller. Please see the code config below: //$options = ...
Prerit Mohan's user avatar
1 vote
0 answers
40 views

8 - How can I update the entity reference fields of the form when I close the modal?

How can I update the entity reference fields of the form based on selection in the modal dialog when I close the modal ? I have a form and users starts fill the form. Then click on choose address ...
hhvardan's user avatar
-1 votes
1 answer
228 views

on click popup load another popup and close other popup

I'm having a requirement where I have to show popup on the click link. and then after that pop up open need to show related content on that pop-up. this part is working. by doing this <a class="...
mintra's user avatar
  • 155
0 votes
1 answer
758 views

How to get my button in a dialog click?

I have added the following JS to a node form, it clones the submit button but clicking it inside the dialog (which does show up) doesn't submit the form in the browser, just nothing happens when the ...
̷c̷h̷x̷'s user avatar
0 votes
1 answer
419 views

Show rendered node in jQuery modal through JSON

Whenever a link has a specific class I want to show it as a jQuery modal. I have added the neccesarry data attributes to the link in order to be able to use it as a modal. I have also created a route ...
user avatar
0 votes
1 answer
632 views

Create a modal popup

I want to show a modal popup in drupal 7. On searching the web I came to know that it can be done using the ctools module itself. Here is the code I tried: function codeexpertz_menu() { $items['...
Estaa Shah's user avatar
1 vote
1 answer
893 views

How do I use Bootstrap theme's modal.jquery.ui.bridge's mapped events?

I am using a Bootstrap subtheme, and would like to trigger an event when a modal is closed. Reviewing the main theme's modal.jquery.ui.bridge.js file, I see that the bridge is intending to map jQuery ...
akalata's user avatar
  • 592
0 votes
1 answer
59 views

Modal dialog doesn't work

I want to display ctools modal. I tried the following code. /** * Implements hook_menu(). */ function my_module_menu() { $items['my_module/%ctools_js/test-page'] = array( 'title' => 'Demo ...
Ahmad's user avatar
  • 2,835
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 ...
Vaibhav Gidde's user avatar
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 ...
Yuri's user avatar
  • 618