It should be possible to submit forms via AHAH. But when validate or submit handlers call drupal_goto(), they break AHAH submission by forwarding to a new page before a JSON response can be returned.
To prepare the way for AHAH form submission, we should eliminate drupal_got() calls from form processing.
Form validate and submit handlers that call drupal_goto() include:
* comment_admin_overview_validate
* search_admin_settings_validate
* system_modules_uninstall_validate
Some of this may be fixable simply by replacing some drupal_goto() calls with setting $form_state['redirect'] as was done in #329660: drupal_goto() in node_configure_validate() is WRONG. But beyond that we'll need a broader solution.
Usually, drupal_goto() calls are designed to interrupt form processing. Probably we need the ability for a particular validate handler to designate a goto value. Then before going to the next validate handler we look for this value and respond accordingly.
Comment | File | Size | Author |
---|---|---|---|
#10 | 357336-10.patch | 635 bytes | valthebald |
Comments
Comment #1
starbow CreditAttribution: starbow commented+1 This is absolutely needed to free up the possibilities of how clientside ajax can interact with Drupal.
One of the things I played with in my old popups in D7 patch was breaking drupal_goto into two functions, one that calculated the path, and one that actually did the redirect. That way Ajax calls can receive the path of the next recommended page, and make their own decision on how to load that page, or how much of it to load. This also required putting a hook into drupal_redirect_form.
Comment #2
skilip CreditAttribution: skilip commented+1 for starbows approach! I did the same thing in my Floating Windows module. I did it using hook_form_alter, which is bad practice, I know... I'm very much willing to contribute to standardize popups functionality. Let me know if I can help!
Comment #3
sunComment #4
sunIntroducing a new tag for feature freeze: API clean-up.
Comment #5
nedjo#122130: Replace drupal_not_found() and drupal_access_denied() with constants is related in that it also removes a barrier to AJAX page loading.
Comment #6
rfaySubscribing
Comment #7
sun.core CreditAttribution: sun.core commentedThis would have been nice to do in terms of the new AJAX framework in D7, but it's too late now.
Comment #8
catchDowngrading all D8 criticals to major per http://drupal.org/node/45111
Also this may be a duplicate of other issues like the actions one, but leaving open for now.
Comment #9
quicksketchThe only one remaining as of Drupal 7.0 is system_modules_uninstall_validate(). This one also looks as though it would be an easy fix.
Comment #10
valthebaldit was :)
Comment #11
areke CreditAttribution: areke commentedUnfortunately, this patch no longer applies. It should be rebased.
Comment #12
haithem_pro CreditAttribution: haithem_pro commentedbegin to work on
Comment #13
haithem_pro CreditAttribution: haithem_pro commentedThe code was refactored the same logic was reproduced in the method below so no need to apply the patch.
See below at line 128 core/modules/system/lib/Drupal/system/Form/ModulesUninstallForm.php