You are here

function finder_form_validate in Finder 7.2

Same name and namespace in other branches
  1. 6 includes/finder.form.inc \finder_form_validate()
  2. 7 includes/finder.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/form.inc
FAPI definition for the finder form.

File

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

Code

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