function form_test_programmatic_form_validate

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

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.