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.
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.
Comment | File | Size | Author |
---|---|---|---|
#19 | D7-install-profile-ajax-1334818-19.patch | 2.09 KB | pirog |
#15 | ajax_testing_profile.tar_.gz | 2.21 KB | laceysanderson |
#8 | D7-install-profile-ajax-1334818-8.patch | 1.64 KB | pirog |
Comments
Comment #1
rfayI've definitely never tried that. Multistep forms I've seen often, but don't think I've done AJAX.
Comment #2
dobe CreditAttribution: dobe commentedI 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
Comment #3
dobe CreditAttribution: dobe commentedUpdating the version as I am using latest version of Drupal
Comment #4
burkeker CreditAttribution: burkeker commentedSame here. I've replicated the ajax_example and assigned it to hook_install_tasks... the throbber shows but no results returned.
Comment #5
pirog CreditAttribution: pirog commentedThe 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.
Comment #6
pirog CreditAttribution: pirog commentedSo 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.
Comment #7
pirog CreditAttribution: pirog commentedWhoops! Here is a patch without the weird color characters.
Comment #8
pirog CreditAttribution: pirog commentedNoticed this doesn't play nice with ajax_base_page_theme
Comment #9
Andrew_Mallis CreditAttribution: Andrew_Mallis commented+1
Comment #10
gromani14 CreditAttribution: gromani14 commented+1
Comment #11
Matias Andreatta CreditAttribution: Matias Andreatta commented+1
Comment #12
sjbassett CreditAttribution: sjbassett commented+1
Comment #13
dariogcode CreditAttribution: dariogcode commented+1
Comment #14
mrynearson CreditAttribution: mrynearson commented+1
Comment #15
laceysanderson CreditAttribution: laceysanderson commentedI 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.
Comment #16
pirog CreditAttribution: pirog commentedShould likely rework this to make use of drupal_installation_attempted()
Comment #17
pirog CreditAttribution: pirog commentedComment #18
pirog CreditAttribution: pirog commentedActually. 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.
Comment #19
pirog CreditAttribution: pirog commentedI like this less because i'm not sure how this will impact other usage of drupal_installation_attempted() but here it is for discussion