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

1 string reference to 'ajax_example_submit_driven_callback'
ajax_example_submit_driven_ajax in ajax_example/ajax_example.module
A very basic form which with an AJAX-enabled submit.

File

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

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;
}