Ron Parker wrote:
I submitted this issue here: http://drupal.org/node/387674, but I really need a response. I think this may be a bug, but I can't be sure right now. Need some advice.
I have created a form. I want to submit the form values, validate them, then confirm that the user wishes to proceed. I place a drupal_execute('confirmation_form', $form_values) in my submit hook, and in the 'confirmation_form' I execute "confirm_form". But, it doesn't work. I don't get a confirmation form: the code execution cycles through to conformation_form_submit.
*form()* Input values
* *
*form_validate()* validate values
* *
*form_submit()* Now, I want to confirm that the user wants to continue. If I call a form from within this submit hook that executes a confirm_form, the confirm_form() function doesn't work
* *
*form_confirm()* Execute confirm_form() doesn't work.
Code example:
Yes, drupal_execute() submits a form. it does not render the form. The idea there is that it happens completely independently. To do what you want to do, you are going to need to cache the values from your first form somewhere (possibly via values on the confirm form) and do your work in the confirm form submit. In addition, you have the problem that there is no communication between FAPI and whatever called drupal_get_form; your submit cannot actually render a form (it returns a value to redirect to, not output) so the only way you can do this without hacking fapi like I did is to set a global variable. You could also install CTools and use the form wizard tool which this is a nice example of, and in fact might make a lovely example of how to do a more complex confirm form than the ones that currently exist.