function tripal_cv_form_fields_validate

2.x tripal_cv.cv_form.inc tripal_cv_form_fields_validate($form, &$form_state)
3.x tripal_chado.cv.inc tripal_cv_form_fields_validate($form, &$form_state)

Generic validation form for shared fields of both the edit and add forms

2 calls to tripal_cv_form_fields_validate()
tripal_cv_cv_add_form_validate in tripal_chado/includes/tripal_chado.cv.inc
Validation fucntion for tripal_cv_cv_add_form
tripal_cv_cv_edit_form_validate in tripal_chado/includes/tripal_chado.cv.inc
Validation fucntion for tripal_cv_cv_edit_form

File

tripal_chado/includes/tripal_chado.cv.inc, line 213

Code

function tripal_cv_form_fields_validate($form, &$form_state) {
  $name = array_key_exists('name', $form_state['values']) ? trim($form_state['values']['name']) : '';
  $desc = array_key_exists('definition', $form_state['values']) ? trim($form_state['values']['definition']) : '';
  $cv_id = array_key_exists('cv_id', $form_state['values']) ? trim($form_state['values']['cv_id']) : '';


  // make sure the cv name is unique
  $values = array('name' => $name);
  $results = chado_select_record('cv', array('cv_id'), $values);
  if (count($results) > 0 and $results[0]->cv_id != $cv_id) {
    form_set_error('name', 'The vocabulary name must be unique');
  }
}