Questions tagged [modal-dialogs]
Use it for questions about modal popup dialogs, including the overlay implemented in the Drupal 7 Overlay module.
151
questions
1
vote
1
answer
77
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
1
answer
111
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 ...
0
votes
0
answers
50
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 ...
1
vote
1
answer
98
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
321
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
248
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
273
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
51
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\...
1
vote
1
answer
165
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(...
0
votes
1
answer
386
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="...
1
vote
0
answers
132
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
637
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 ...
0
votes
1
answer
34
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
127
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
777
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
691
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="{"width":...
0
votes
1
answer
51
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 ...
0
votes
0
answers
193
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
86
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 ...
0
votes
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 "...
0
votes
0
answers
684
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
184
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
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) {
....
$...
1
vote
1
answer
789
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
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="{&...
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="{"width":400}&...
2
votes
2
answers
999
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
149
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
268
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
82
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
218
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="{"width":400}"
data-dialog-type="modal"
href="/some/path">
Some ...
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 ...
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 ...
1
vote
1
answer
350
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="{"width":600}" data-dialog-type="modal" href="/node/...
2
votes
1
answer
567
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 ...
0
votes
1
answer
577
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 ...
1
vote
1
answer
858
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('...
1
vote
1
answer
45
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 ...
0
votes
1
answer
328
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 ...
0
votes
0
answers
90
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 = ...
1
vote
0
answers
39
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 ...
-1
votes
1
answer
194
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="...
0
votes
1
answer
676
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 ...
0
votes
1
answer
407
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 ...
0
votes
1
answer
560
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['...
1
vote
1
answer
865
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 ...
0
votes
1
answer
58
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 ...
1
vote
2
answers
181
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 ...
0
votes
2
answers
2k
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 ...