$form["#action"] gets set to /ahah_helper/path

yfreeman - September 15, 2009 - 17:31
Project:AHAH helper
Version:6.x-2.0
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

I ran into this problem by doing the following.

1. display a form using ahah_helper
2. fire an ahah event, i.e. update a drop down etc.
3. once the form is updated. Break one of the validation rules of the form. i.e. leave a required field balnk etc. so drupal will used the cached form
4. submit the form.
5. form is reloaded once again, due to validation errors, but the where "path" will be the last ahah_helper path called will be filled.

If you try to submit the form you will be going to the wrong submittal page.

After some investigation, it turns out when the form is rebuilt on line 188 in ahah_helper.module, since the $form["#action"] is not predefined it will populate it with the current $_GET["q"] value, and at the that instance the $_GET["q"] is the ahah_helper menu path.

One way around this is to have the forms explicitly define the $form["#action"] value. but for some dynamically generated forms or other use cases this may not be practical.

#1

mdevrel - October 19, 2009 - 15:18

I can confirm this issue and the pseudo-fix.

I'm not too familiar with forms, or how the Ahah Helper works, but should/could $form['#action'] be set and pulled from the cache?

 
 

Drupal is a registered trademark of Dries Buytaert.