You are here

function conditional_fields_dependency_add_form_validate in Conditional Fields 7.3

Dependency add form validate.

See also

conditional_fields_dependency_add_form()

conditional_fields_dependency_add_form_submit()

File

includes/conditional_fields.admin.inc, line 285
Administration of dependencies.

Code

function conditional_fields_dependency_add_form_validate($form, &$form_state) {
  if ($form_state['values']['dependee'] == $form_state['values']['dependent']) {
    form_set_error('dependent', t('You should select two different fields.'));
    form_set_error('dependee', t('You should select two different fields.'));

    // Workaround to avoid duplicate error messages.
    array_pop($_SESSION['messages']['error']);
  }
}