function form_test_programmatic_form_validate in Drupal 7
Form validation handler for programmatic form submissions.
To test that the validation handler is correctly executed, the field value is explicitly required here.
File
- modules/
simpletest/ tests/ form_test.module, line 1763 - 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.'));
}
}