I currently have a multi step form that collects user information. The form functionality is for user searching (and selection).

Once a selection is made I would like to pass some data from the multi step form to page which is being generated by a template.

The workflow is something to the effect of:

1. hook_menu() -> multi step form
2. Collect information from multi step form
3. Pass information to to template function where I'm able to generate something to the effect of:

$build['my_element'] = array(
'#theme' => 'my_theme',
'#title' => $title,
'#multistep_arguments' => array(...),
);

$output = drupal_render($build);

return $output;

Comments

nevets’s picture

Template should not really generate data, I use the "last step" of the multistep form to process the user inputs and generate the data.

rwoconnor82’s picture

I'm still pretty new to the drupal "right way" of doing things.

So if I abandon the template I'm not really sure what the right approach is to set up that kind of output.

If I use the last step of the form... wouldn't I end up with a very unmanageable function with a lot of print statements generating html at that point? I know there's a better way to put that into practice so maybe my question is more appropriate to say what is that better method?

rwoconnor82’s picture

I've ended up by modifying the code to behave in the following way:

Menu link -> form output function

The form contains the user lookup logic and a submit button.
I check $form_state for a variable that is set in the submit handler... and if present $form['result']['#markup'] is set to the value contained in the submit handler (which would be the output of drupal_render() for the object I want to theme and generate the data for... the search results are passed by way of $form_state).

This might not be right the right way to do things though and if you have suggestions as to better design I'd like to hear advice!

thanks for the input!