[support] Multipart Form in 6.x

Jamie Holly hovercrafter at earthlink.net
Fri Jan 15 06:24:06 UTC 2010


This would be a good candidate for AHAH. Take a look at poll.module, 
which pretty much does what you're asking for adding additional choices 
to the poll.

Jamie Holly
http://www.intoxination.net
http://www.hollyit.net


On 1/15/2010 1:16 AM, David Spindler wrote:
> I'm trying to figure out the magic of a multipart form.
>
> I'm trying to have a user register his family. So he goes to a form
> which has a blank for one person and he keeps clicking "Add another
> person" until he has enough blanks for all his family members at which
> point he can hit "Save" and it's processed.
>
> Currently I'm doing this in form_validate. If they clicked the Add
> Another Person button I called form_set_error('',''). Which returns
> them to the form w/o giving them an error. All the form data is still
> filled in. If the click the Save button I validate and return and
> form_submit() is called which saved the data.
>
> I'm trying to figure out how to pass hidden data so that it can't be
> tampered with (For example a family id). Initially I was using a
> hidden field with a #value (as opposed to #default_value) under the
> assumption that Drupal would validate the field for me and ensure it
> was not changed. This doesn't seem to be the case and I'm trying to
> figure out another way to keep data with my form w/o having it
> tampered with. I tried using a field of #type 'value', but that didn't
> seem to get passed back into with the $form_state for the next
> iteration. A couple of thoughts I had.
>
> 1. Validate the hidden data myself in the validate function comparing
> $form_state and $form.
> 2. Change the way I'm doing this to a more drupal approved way so that
> it will validate my hidden data for me? (Is there a flag I can set)
> 3. Figure out how to get value fields passed  between form submissions.
>
>
> Thanks, David
>    


More information about the support mailing list