function conditional_fields_dependency_edit_form_validate in Conditional Fields 7.3
Dependency edit form validate.
See also
conditional_fields_dependency_edit_form()
File
- includes/
conditional_fields.admin.inc, line 730 - Administration of dependencies.
Code
function conditional_fields_dependency_edit_form_validate($form, &$form_state) {
if ($form_state['values']['condition'] == 'value') {
if (in_array($form_state['values']['values_set'], array(
CONDITIONAL_FIELDS_DEPENDENCY_VALUES_AND,
CONDITIONAL_FIELDS_DEPENDENCY_VALUES_OR,
CONDITIONAL_FIELDS_DEPENDENCY_VALUES_XOR,
CONDITIONAL_FIELDS_DEPENDENCY_VALUES_NOT,
)) && drupal_strlen(trim($form_state['values']['values'])) == 0) {
form_set_error('values', t('!name field is required.', array(
'!name' => t('Set of values'),
)));
}
elseif ($form_state['values']['values_set'] == CONDITIONAL_FIELDS_DEPENDENCY_VALUES_REGEX && drupal_strlen(trim($form_state['values']['regex'])) == 0) {
form_set_error('regex', t('!name field is required.', array(
'!name' => t('Regular expression'),
)));
}
}
}