[development] hook_form() and multistep

Andy Chase ac at greyledge.net
Fri Dec 21 19:11:26 UTC 2007


Hi Ryan,

I'm a month and a half late to the party, but I just came up against  
this exact same issue.  I am by no means  a Node API/FAPI 2 superstar  
so I can't say this authoritatively, but as far as I can tell from  
all of the open-ended "Multistep node form" discussion threads  
floating around drupal.org it is not possible to implement a multi- 
step form with hook_form.*    Instead, it seems like people generally  
resort to implementing a #multistep form definition, calling it with  
a drupal_get_form() menu callback, and then using node_save() in  
their form's _submit() handler to store the node in the database.

*I would _love_ to be  totally wrong, chastised, and corrected on  
this point - if anyone has actually accomplished a multistep  
implementation of hook_form() in Drupal 5, a howto would make them an  
instant Drupal folk hero!

Looking forward to FAPI 3,
-Andy

On Nov 8, 2007, at 12:29 PM, Ryan Courtnage ☠ wrote:

> Hello All,
>
> I'm attempting to make a multistep node submission form in D5
>
> All the examples using #multistep I find assume the form is being
> rendered by drupal_render_form(), which passes the form values as the
> 2nd argument.  These form values can contain the step number that is
> used to decide which form fields to render, and what to
> validate/submit.
>
> In my case, however, it's a node submission form .. hook_form() is
> being used (not  drupal_render_form()).  hook_form() gets passed the
> node object, but not the form values.  As a result, I'm not able to
> determine what step I'm on.
>
> I'm assuming it's possible to make a multistep node submission form.
> Can someone point me in the right direction?
>
> Thanks!
> Ryan
>









More information about the development mailing list