1 ajax_example.module | ajax_example_submit_driven_callback($form, $form_state) |
Callback for submit_driven example.
Select the 'box' element, change the markup in it, and return it as a renderable array.
Return value
array: The renderable array for the box element.
Related topics
File
- modules/
examples/ ajax_example/ ajax_example.module, line 529 - Hook implementations for the AJAX Example module.
Code
function ajax_example_submit_driven_callback($form, $form_state) {
// In most cases, it is recommended that you put this logic in form generation
// rather than the callback. Submit driven forms are an exception, because
// you may not want to return the form at all.
$element = $form['box'];
$element['#markup'] = "Clicked submit ({$form_state['values']['op']}): " . date('c');
return $element;
}