You are here

function finder_form_validate in Finder 7

Same name and namespace in other branches
  1. 6 includes/finder.form.inc \finder_form_validate()
  2. 7.2 includes/form.inc \finder_form_validate()

Validate function for finder form.

Implements the 'validate_empty' functionality.

See also

finder_form()

1 string reference to 'finder_form_validate'
finder_form in includes/finder.form.inc
FAPI definition for the finder form.

File

includes/finder.form.inc, line 153
The finder form.

Code

function finder_form_validate($form, &$form_state) {
  $finder_id = $form_state['values']['finder_id'];
  $finder = finder_load($finder_id);
  if ($finder->settings['advanced']['validate_empty']) {
    $all_empty = TRUE;
    foreach ($finder->elements as $finder_element) {
      if (!empty($form_state['values'][$finder_element->finder_element_id])) {
        $all_empty = FALSE;
        break;
      }
    }
    if ($all_empty) {
      form_set_error('form', t('Please complete the %finder form.', array(
        '%finder' => $finder->title,
      )));
    }
  }
}