You are here

function flag_form_validate in Flag 7.3

Same name and namespace in other branches
  1. 5 includes/flag.admin.inc \flag_form_validate()
  2. 6.2 includes/flag.admin.inc \flag_form_validate()
  3. 6 includes/flag.admin.inc \flag_form_validate()
  4. 7.2 includes/flag.admin.inc \flag_form_validate()

Add/Edit flag form validate.

File

includes/flag.admin.inc, line 667
Contains administrative pages for creating, editing, and deleting flags.

Code

function flag_form_validate($form, &$form_state) {
  $form_state['values']['title'] = trim($form_state['values']['title']);
  $form_values = $form_state['values'];
  $flag = $form['#flag'];
  $flag
    ->form_input($form_values);
  $errors = $flag
    ->validate();
  foreach ($errors as $field => $field_errors) {
    foreach ($field_errors as $error) {
      form_set_error($field, $error['message']);
    }
  }
}