You are here

function views_ifempty_handler_field::options_validate in Views If Empty 7

Same name and namespace in other branches
  1. 6 handlers/views_ifempty_handler_field.inc \views_ifempty_handler_field::options_validate()

Validate the options form.

Overrides views_handler::options_validate

File

includes/views/handlers/views_ifempty_handler_field.inc, line 72
A views handler to output an alterate field when a field is empty.

Class

views_ifempty_handler_field
@file A views handler to output an alterate field when a field is empty.

Code

function options_validate(&$form, &$form_state) {
  $values =& $form_state['values']['options'];
  if (empty($values['emptyfield']) || empty($values['outputfield'])) {
    if (empty($values['emptyfield'])) {
      form_set_error('emptyfield', t('Empty field must be specified.'));
    }
    if (empty($values['outputfield'])) {
      form_set_error('outputfield', t('Output field must be specified.'));
    }
  }
  elseif ($values['emptyfield'] == $values['outputfield']) {
    form_set_error('outputfield', t('The output field must be different from the empty field.'));
  }
}