[support] D6 form submit (not), cache, double redirect back and reload from cache?

Doug doug.duboulay at gmail.com
Mon Nov 22 23:31:08 UTC 2010


Writing a D6 module.
I'm trying to build a lengthy form, where at some point, towards
the bottom of the form, it would be nice to 
(1) optionally hit an 'incomplete'/branch submit handler,
(2) cache the interim curent form state, 
(3) double redirect to a new form (create submit ) etc 
(4) bounce back to the original (with second redirect), 
(5) reload interim state from the cache, 
(6) amend with new details gleaned from the intermediate/branch form, 
(7) finally proceed to the "complete" form submit handler of original form

Currently I can double redirect to a second form, but on bounce back,
all the original details are lost, which is really unintuitive to 
the user, who thinks they've already filled out that part.

I guess I need to do something like this:

function mymodule_interim_submit($form, &$form_state) {
  $form_build_id = $form_state['values]['form_build_id'];
  unset($form_state['submitted']); 
  unset($form_state['storage']);  // $form_state['rebuild'] = FALSE;
  $form_state['saved']= $form_state['values];
  $form_state['redirect'] = array (   // double redirect
     'mymodule/intermediate_form',
     'mymodule/this_form/' . $form_build_id
  );
}

But I don't know if thats sufficient to preserve the interim state 
of the form, or will it still be deleted from the cache after 
the interim_submit completes, or ...(barking up wrong tree)?

thanks
Doug


More information about the support mailing list