[support] A standard technique for module confirmation dialogues?

Doug doug.duboulay at gmail.com
Fri Apr 23 04:39:24 UTC 2010


I'm writing a Drupal6 module that does read/write/updates to
my own tables in the database using the forms API.
There are a few instances where I would like to present a
confirmation dialogue before updating the database, 
but I'm not sure what is the standard way to implement that?
For example if I have a menu item that calls a function  
mymodule_foo() like this:


function mymodule_foo() {
  return drupal_get_form('mymodule_foo_form') ;
}

function mymodule_foo_form(&$context) {
  $form[] = array(
    '#type' => 'fieldset',
    '#title' => t('Review table Foo'),
  );
  // .... whatever form data
  $form['#validate'][] = 'mymodule_validate_foo_form';
  $form['#submit'][] = 'mymodule_submit_foo_form';
  return $form;
}

function mymodule_validate_foo_form(&$form, &$form_state) {

}

function mymodule_submit_foo_form(&$form, &$form_state) {
  // update {mymodule_foo} table in database 
  drupal_write_record('mymodule_foo',$record,$foo_id);
}

I guess I'm just wondering if there is some standard approach to
generating an intermediate confirmation page before 
actually making the drupal_write_record() call(s)?

thanks
Doug



More information about the support mailing list