You are here

function ajax_example_simplest_callback in Examples for Developers 7

Callback for ajax_example_simplest.

On an ajax submit, the form builder function is called again, then the $form and $form_state are passed to this callback function so it can select which portion of the form to send on to the client.

Return value

array Renderable array (the textfield element)

Related topics

1 string reference to 'ajax_example_simplest_callback'
ajax_example_simplest in ajax_example/ajax_example.module
Basic AJAX callback example.

File

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

Code

function ajax_example_simplest_callback($form, $form_state) {

  // The form has already been submitted and updated. We can return the replaced
  // item as it is.
  return $form['replace_textfield'];
}