function batch_example_simple_form_submit
Same name in other branches
- 7.x-1.x batch_example/batch_example.module \batch_example_simple_form_submit()
Submit handler for the form 'batch_example_simple_form'.
This submit handler will be called when the user clicks 'Go' in the form.
Related topics
File
-
batch_example/
batch_example.module, line 98
Code
function batch_example_simple_form_submit($form, &$form_state) {
// Dropdown will return 'batch_1' or 'batch_2'
$values =& $form_state['values'];
// Create a string with the function name 'batch_example_batch_1'
// or 'batch_example_batch_2'
$function = 'batch_example_' . $values['batch'];
// Load the $batch variable with an array containing the details
// of what to run
$batch = $function();
// Start the batch process running
batch_set($batch);
// Redirection takes place as usual.
$form_state['redirect'] = 'batch_example/example_2';
}