You are here

function views_ifempty_handler_field::options_validate in Views If Empty 6

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

Validate the options form.

File

handlers/views_ifempty_handler_field.inc, line 64
Views field handler to output an alterate field when a field is empty.

Class

views_ifempty_handler_field
@file Views field 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.'));
  }
}