Investigating the function form_set_error I find functionality to work with it so far never used. On the one hand we have the faults so far in the form. Suppose a form called test and want to know all the validation errors that will occur.
/**
* Implementation of hook_form_alter().
*/
function test_form_alter(&$form, &$form_alter, $form_id) {
if ($form_id == 'test_form') {
$form['#validate'][] = 'test_form_validate_errors';
}
}
function test_form_validate_errors($form, &$form_state) {
$errors = form_set_error(NULL, NULL);
}
Once this is done in $errors have an array of all the validation errors that have the form. But suppose you want to reset the validation errors and process them and display them at will. Test_form_validate_errors then have the following:
function test_form_validate_errors($form, &$form_state) {
$errors = form_set_error(NULL, NULL);
//Reset errors
form_set_error(NULL, NULL, TRUE);
//Process errors
.
.
.
}
Comments
I didn't know it!!!
Permalink Submitted by Fran (not verified) on Sun, 09/11/2011 - 15:14.
Takes precedence in the order
Permalink Submitted by admin on Sun, 09/11/2011 - 16:36.
Add new comment