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

nan wich nan_wich at bellsouth.net
Sun Mar 14 02:36:00 UTC 2010

In Drupal, I recommend staying away from hidden values as they actually do allow for a miniscule possibility of hacking. Instead use '#type' => 'value' which will not present on the rendered form. I have never had any trouble with altering it in multistep forms.
Nancy E. Wichmann, PMP
Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.

From: Hans Langouche <hans.langouche at gmail.com>
To: development at drupal.org
Sent: Sat, March 13, 2010 8:53:26 AM
Subject: [development] form_api: same form called multiple times, wrong form_state values

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 ?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20100313/d58acdb2/attachment-0001.html 

More information about the development mailing list