You are here

function drupal_validate_form_new in Views (for Drupal 7) 6.3

Same name and namespace in other branches
  1. 6.2 includes/form.inc \drupal_validate_form_new()

The original version of drupal_validate_form does not have an override for the static check to only validate a form id once. Unfortunately, we need to be able to overridet his.

1 call to drupal_validate_form_new()
drupal_process_form_new in includes/form.inc
Views' replacement for drupal_process_form that accepts commands not to redirect, as well as forcing processing of 'get' method forms.

File

includes/form.inc, line 236
form.inc Views' replacements for Drupal's form functions.

Code

function drupal_validate_form_new($form_id, $form, &$form_state) {
  static $validated_forms = array();
  if (isset($validated_forms[$form_id]) && empty($form_state['must_validate'])) {
    return;
  }

  // If the session token was set by drupal_prepare_form(), ensure that it
  // matches the current user's session.
  if (isset($form['#token'])) {
    if (!drupal_valid_token($form_state['values']['form_token'], $form['#token'])) {

      // Setting this error will cause the form to fail validation.
      form_set_error('form_token', t('Validation error, please try again. If this error persists, please contact the site administrator.'));
    }
  }
  _form_validate($form, $form_state, $form_id);
  $validated_forms[$form_id] = TRUE;
}