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
Doug ha scritto:
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)?
*|confirm_form($form, $question, $path, $description = NULL, $yes = NULL, $no = NULL, $name = 'confirm')
http://api.drupal.org/api/function/confirm_form/6
I hope that this is what you need.
M.
|*