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: Renderable array (the box element)

Related topics


modules/examples/ajax_example/ajax_example.module, line 532
AJAX Examples module file with basic examples.


function ajax_example_submit_driven_callback($form, $form_state) {
  // In most cases, it is recomended 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;