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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ethanhinson’s picture

Title: Form not appended to back DOM after closing the modal » Form not appended back to DOM after closing the modal
ethanhinson’s picture

Issue summary: View changes
drunken monkey’s picture

Thanks 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.

ethanhinson’s picture

Thanks 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

  • Use Form API AJAX implementation
  • Create a theme function for placing the form in the Views area handler (or other places), this way modules and themes can preprocess
  • It is only my opinion, but I would contend that it may be presumptuous to handle all the display in the core module. As this seems like a feature themes/modules may want to take control over (I know I did).

Overall, I love this module and really appreciate the effort you've put forth to make it happen.

drunken monkey’s picture

Version: 7.x-1.2 » 7.x-1.x-dev
Status: Active » Needs review
FileSize
1.21 KB

Overall, I love this module and really appreciate the effort you've put forth to make it happen.

As 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!

drunken monkey’s picture

Status: Needs review » Fixed

OK, I'm pretty sure this works as intended. So, committed!

  • drunken monkey committed 4026d15 on 7.x-1.x
    Issue #2347951 by drunken monkey: Fixed vanishing form after closing the...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.