1 form_test.module form_test_programmatic_form_validate($form, &$form_state)

Form validation handler for programmatic form submissions.

To test that the validation handler is correctly executed, the field value is explicitly required here.

File

core/modules/simpletest/tests/form_test.module, line 2118
Helper module for the form API tests.

Code

function form_test_programmatic_form_validate($form, &$form_state) {
  if (empty($form_state['values']['textfield'])) {
    form_set_error('textfield', t('Textfield is required.'));
  }
}