[development] form_api: same form called multiple times, wrong form_state values

Randy Fay randy at randyfay.com
Sat Mar 13 20:27:02 UTC 2010


When you get an answer, please let me know, as I keep score on these :-)

Thanks,
-Randy

On Sat, Mar 13, 2010 at 12:35 PM, Hans Langouche
<hans.langouche at gmail.com>wrote:

>  Hi Randy,
>
> tnx for the help, but neither of those (which I came across as well) are
> relevant in this case. 'storage' isn't used and neither is ajax.
>
> Greetz,
>
> HnLn
>
>
> Randy Fay wrote:
>
> There are two problems that I know of with multiple forms on a page in D6:
>
> http://drupal.org/node/386678 (fixed in D7): If any form uses
> $form_state['storage'] then it destroys $_POST, causing the other(s) not to
> be able to submit. This one has a demo module that you may be able to use to
> see if you're having the same problem.
>
> http://drupal.org/node/384992 (still open in D7): In an AJAX/AHAH form,
> form_clean_id() (D6) or drupal_html_id (D7) doesn't work right, so you end
> up having to use hook_forms() to make the form_id of each form different.
>
> -Randy
>
> On Sat, Mar 13, 2010 at 6:53 AM, Hans Langouche <hans.langouche at gmail.com>wrote:
>
>> Hi all,
>>
>> I have a small admin form (2 buttons and a hidden value) that is repeated
>> multiple times (each time the value is different).
>>
>> Now whenever I access $form_state['values'] from the submit function, the
>> hidden value always returns the data from the first form.  When I print out
>> $_POST directly I do get the correct data.
>>
>> I've been searching this and it seems this is because the form_state is
>> cached.  I couldn't find any workaround though, so for the moment working
>> with $_POST.  Anyone know the correct way to do this ?
>>
>> Tnx,
>>
>> HnLn
>>
>
>
>
> --
> Randy Fay
> Drupal Development, troubleshooting, and debugging
> randy at randyfay.com
> +1  970.462.7450
>
>


-- 
Randy Fay
Drupal Development, troubleshooting, and debugging
randy at randyfay.com
+1  970.462.7450
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20100313/7d6a2003/attachment.html 


More information about the development mailing list