[development] confirm_form from submit hook

Michael Prasuhn mike at mikeyp.net
Wed Mar 4 00:21:45 UTC 2009


On Mar 3, 2009, at 11:55 AM, Ron Parker wrote:
> Thank you. This helped.  What I did was to create my confirm_form  
> function as a menu callback:

> So, in my submit hook, I do a "drupal_goto" (as opposed to  
> drupal_execute or drupal_get_form) and put the key variable in the  
> argument as part of the url.  This works.  But, seems to me that it  
> would be much easier to be able to call another form and pass form  
> variables from a submit hook (as I was attempting to do).


It's also quite possible that you could open a cross site request  
forgery that way. What you are really asking about is multi-step form.  
'Confir'm is not a hook that is automatically recognized in FAPI in  
the way the _submit and _validate are. There is an example of what you  
are trying to do in core, in the node module for the page at admin/ 
content/node, and the batch operations for that page, which provides a  
confirm form without redirecting the user at all.

To see a better example (node is a little long and slightly confusing)  
you could look at this module file in CVS: http://cvs.drupal.org/viewvc.py/drupal/contributions/sandbox/mikeyp/system_table_cleaner/system_table_cleaner.module?revision=1.3&view=markup

This is a short module I wrote that implements functionality similar  
to what you seem to want. Most importantly, look at the  
system_table_cleaner() function and it's switching and return of a  
different form. This was modeled after the core method used in node  
module.

-Mike

__________________
Michael Prasuhn
503.488.5433 office
714.356.0168 cell
503.661.7574 home
mike at mikeyp.net
http://mikeyp.net







More information about the development mailing list