Download & Extend

Remove drupal_goto() calls from system_modules_uninstall_validate()

Project:Drupal core
Version:8.x-dev
Component:forms system
Category:task
Priority:normal
Assigned:Unassigned
Status:active
Issue tags:API clean-up

Issue Summary

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.

Comments

#1

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

#2

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

#3

Title:Remove drupal_goto() calls from form validate and submit handlers--they break AHAH» Remove drupal_goto() calls from form validate and submit handlers - they break AHAH/AJAX
Priority:normal» critical

#4

Introducing a new tag for feature freeze: API clean-up.

#5

#122130: Replace drupal_not_found() and drupal_access_denied() with constants is related in that it also removes a barrier to AJAX page loading.

#6

Subscribing

#7

Version:7.x-dev» 8.x-dev

This would have been nice to do in terms of the new AJAX framework in D7, but it's too late now.

#8

Priority:critical» major

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

#9

Title:Remove drupal_goto() calls from form validate and submit handlers - they break AHAH/AJAX» Remove drupal_goto() calls from system_modules_uninstall_validate()
Priority:major» normal

Form validate and submit handlers that call drupal_goto() include:

* comment_admin_overview_validate
* search_admin_settings_validate
* system_modules_uninstall_validate

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