Not sure if this is a bug report or a feature request.

If I add a install task of type form and add any type of #ajax to it, it does not work. Nothing is returned in the ajax call.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rfay’s picture

I've definitely never tried that. Multistep forms I've seen often, but don't think I've done AJAX.

dobe’s picture

I was just trying to do the same thing and I am unable to get this to work. I nearly replicated the ajax_example but nothing gets done.

-Jesse

dobe’s picture

Version: 7.9 » 7.23

Updating the version as I am using latest version of Drupal

burkeker’s picture

Same here. I've replicated the ajax_example and assigned it to hook_install_tasks... the throbber shows but no results returned.

pirog’s picture

The error that is produced here is
"Invalid form POST data." which seems to happen when Drupal is unable to load the form data from the cache.

pirog’s picture

Version: 7.23 » 7.24
Issue summary: View changes
Status: Active » Needs review
FileSize
1.34 KB

So for some reason drupal cannot get or set cached forms during the install profile workflow. I do not know why this is and can't investigate further. I've attached a patch which seems to provide a decent workaround and it would be great to get some feedback as this is definitely not my area of expertise.

pirog’s picture

FileSize
1.05 KB

Whoops! Here is a patch without the weird color characters.

pirog’s picture

FileSize
1.64 KB

Noticed this doesn't play nice with ajax_base_page_theme

Andrew_Mallis’s picture

+1

gromani14’s picture

+1

Matias Andreatta’s picture

+1

sjbassett’s picture

+1

dariogcode’s picture

+1

mrynearson’s picture

+1

laceysanderson’s picture

I also can't get AJAX to work on an installation profile form. I have tested it using the Examples Modules forms exactly (not even reproduced, just used that function while defining the installation steps) and can't get it to work even with the supplied patch.

I'm attaching my installation profile (enables the Devel & Examples module and provides the tasks using the Example modules Ajax Example Forms) with drush makefile to aid in debugging of this issue.

To reproduce simply download the installation profile attached and uncompress it in your [drupal root]/profiles directory. Also download the Examples and Devel modules. Then when installing Drupal select profile=ajax_testing_profile. This allows you to click through each of the Examples Module Ajax forms as though they were installation tasks.

pirog’s picture

Should likely rework this to make use of drupal_installation_attempted()

pirog’s picture

Status: Needs review » Needs work
pirog’s picture

Status: Needs work » Needs review

Actually. drupal_installation_attempted() only returns true when on install.php. However this ajax request is going through index.php so drupal_installation_attempted() will always be false. We could update drupal_installation_attempted() to return true for ajax install events as well and then use that... or we could keep what we have in the patch above.

pirog’s picture

I like this less because i'm not sure how this will impact other usage of drupal_installation_attempted() but here it is for discussion

Version: 7.24 » 7.x-dev

Core issues are now filed against the dev versions where changes will be made. Document the specific release you are using in your issue comment. More information about choosing a version.