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.
When creating a modal from pressing a form button, the url that is constructed by concatenating form values with the class <form_id>-url returns the url with /nojs/ in the path. This is causing errors when the modal dialog pops up. Drupal.ajax doesn't process the new url to replace nojs with ajax.
Comment | File | Size | Author |
---|---|---|---|
#1 | ctools-replace_nojs_modal-1694722-1.patch | 298 bytes | tom friedhof |
Comments
Comment #1
tom friedhof CreditAttribution: tom friedhof commentedHere is the patch for this. I took the same replacement pattern from ajax.js in Drupal core. Perhaps there is a way to have Drupal.ajax process this url again so the replacement functionality isn't duplicated. Thoughts?
Comment #2
merlinofchaos CreditAttribution: merlinofchaos commentedSo I think that the reason this was never implemented to do this is that...
if you're in the modal, you've already established that the client is using ajax, and the URLs don't need to have nojs/ajax replacement, and you can just give the proper URL.
I'm trying to think of a use case where this isn't true.
Comment #4
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedThe 6 year old patch to modal.js still applies cleanly to the latest ctools 7.x-1.x-dev, but the issue might need to be closed as won't fix or works as designed per merlinofchaos' comments above.