1 ajax_forms_test.module ajax_forms_test_simple_form($form, &$form_state)

A basic form used to test form_state['values'] during callback.

File

core/modules/simpletest/tests/ajax_forms_test.module, line 44
Simpletest mock module for Ajax forms testing.

Code

function ajax_forms_test_simple_form($form, &$form_state) {
  $form = array();
  $form['select'] = array(
    '#type' => 'select',
    '#options' => array(
      'red' => 'red',
      'green' => 'green',
      'blue' => 'blue'),
    '#ajax' => array(
      'callback' => 'ajax_forms_test_simple_form_select_callback',
    ),
    '#suffix' => '<div id="ajax_selected_color">No color yet selected</div>',
  );

  $form['checkbox'] = array(
    '#type' => 'checkbox',
    '#title' => t('Test checkbox'),
    '#ajax' => array(
      'callback' => 'ajax_forms_test_simple_form_checkbox_callback',
    ),
    '#suffix' => '<div id="ajax_checkbox_value">No action yet</div>',
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('submit'),
  );
  return $form;
}