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
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
On Dec 21, 2007, at 11:11 AM, Andy Chase wrote:
if anyone has actually accomplished a multistep implementation of hook_form() in Drupal 5, a howto would make them an instant Drupal folk hero!
a) I hate to say this, but project_issue does this for issue nodes (though it doesn't use #multistep, it's really more the 4.7.x FAPI style of multi-page forms). http://drupal.org/project/project_issue see, in particular, issue.inc, function project_issue_form() on the DRUPAL-5 branch. b) I hardly think writing it up as a howto is a worthy goal. ;) The code is evil, and all changing in D6... c) I recently ripped all this code out, since we don't really need a full blown multi-step form, and it simplified a lot of ugly code to actually use 2 separate forms for this: http://drupal.org/node/199138 So, the 5.x-2.* version in HEAD no longer uses this approach. ;) Enjoy, -Derek (dww)
participants (3)
-
Andy Chase -
Derek Wright -
Ryan Courtnage ☠