Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Once a user opens the modal to show the form which saves the View, if they close it and then try to re-open, the form is not presented the second time. This is because the calls appending the data attributes to the form and trigger for the modal aren't working as expected. After some testing, I was able to make things work by making the IDs available in Drupal.settings. However, I wasn't able to get the AJAX to work. The form would submit, and save, just no AJAX. I'll gladly roll a patch if you have some direction for your preferred method to solve this issue.
Comment | File | Size | Author |
---|---|---|---|
#5 | 2347951-5--react_to_popup_close.patch | 1.21 KB | drunken monkey |
Comments
Comment #1
ethanhinson CreditAttribution: ethanhinson commentedComment #2
ethanhinson CreditAttribution: ethanhinson commentedComment #3
drunken monkeyThanks for reporting this problem!
I could reproduce it successfully, and already have a fix – however, I've run into the problem that I don't see a clean way to override or hook into the CTools modal's "close" function. All I could do was individually override all the ways to close the popup, which is a bit cumbersome. But, of course, if there is no other solution, then we'll just have to do that.
Anyways, I would be interested in how you solved that? Do you know of a way? The code you currently have might be interesting here.
In any case, the problem doesn't appear when using our own "Cancel" link – I thought of that one –, but occurs when using either the "X" icon in the popup's top right corner, or when closing the popup by pressing ESC.
Comment #4
ethanhinson CreditAttribution: ethanhinson commentedThanks for coming back to this issue. We're using this module pretty heavily in conjunction with Drealty and the Queue API to create a real estate notification system. We did eventually find that for us it made more sense to remove all the JavaScript all together and let the theme layer handle putting things in modals. The form you've built works great without the JavaScript attached to it.
With the notion in mind that the core functionality of the form works without the custom AJAX functionality. I would propose the following changes
Overall, I love this module and really appreciate the effort you've put forth to make it happen.
Comment #5
drunken monkeyAs noted on the project page, the module is funded by herd45, whose idea it also was, so thank him. ;)
Regarding your suggestions:
I don't understand the first one. We are already using Form API AJAX for submitting the form – what else would you use it for?
The second one might make sense, but is a feature request.
Regarding the third one: this behavior was planned from the beginning as part of the module, so that needs to stay in there. However, it might be a reasonable feature request to make it either to opt out of that special handling.
In any case, regarding the issue at hand, I actually found a much cleaner solution. Patch attached, please test!
Comment #6
drunken monkeyOK, I'm pretty sure this works as intended. So, committed!