Just wondering how others are approaching multistep CCK forms in D6? I have seen many examples of multistep forms but not (node) forms for existing CCK types. Based on my understanding of FAPI 6, it looks like there are two options:

(1) Step through the retrieve, process and render functions to repeatedly build and modify the node_form

Since I am trying to override the node_form I thought the initial retrieve call would have to happen in a content_type_node_form function which would be called when the user clicked node/add/contenttype. But since drupal_retrieve_form looks for an existing contenttype_node_form function, I just end up recursing on myself. Which seems obvious. If I call it in a diff function like modulename_stepone, I get a callback error relating to the retrieve function as well errors with missing/wrong arguments even though I call it with dummy &$form_state and $node as args. Maybe they are wrong?

(2) Modify the form via repeated hook_form_alter calls

$form_state only keeps track of the current version of the form so I need to go through hook_form_alter on subsequent steps to put back in fields (and their values) from previous steps. In that case how do you get from your custom submit function after each step back into the hook_form_alter? By merging $form_state with $form to get back the full structure of the node_form?

I get that we use the $form_state variable to keep track of the step, store the latest input values and to decide what to display next based on submit handlers etc. What I don't get is how to load the different parts of a form (as opposed to the full form with past values in it like the poll.module) on different steps and move in and out of various versions of the node_form.

Since there's very little practical FAPI documentation, and it seems like lots of people are trying to do multistep CCK forms, maybe we could use this thread to share ideas on different strategies. Also, if anyone from the FAPI team has time to chip in some thoughts about how they envisioned multistep CCK working, or point to some working examples, that would be fantastic.

Comments

Chill35’s picture

mscdex’s picture

I'd also be interested in hearing what methods everyone is using.

acakadut’s picture

i need to know this too