function tripal_bulk_loader_template_field_form_validate

2.x tripal_bulk_loader.admin.templates.inc tripal_bulk_loader_template_field_form_validate($form, &$form_state)
3.x tripal_bulk_loader.admin.templates.inc tripal_bulk_loader_template_field_form_validate($form, &$form_state)

Implements hook_form_validate().

Related topics

File

tripal_bulk_loader/includes/tripal_bulk_loader.admin.templates.inc, line 2222
All functions in this file pertain to administrative management of bulk loader templates

Code

function tripal_bulk_loader_template_field_form_validate($form, &$form_state) {

  // Don't worry about validation when Cancel button is clicked
  if ($form_state['clicked_button']['#value'] == 'Save Changes') {
    $is_unique = tripal_is_bulk_loader_record_name_unique(
    $form_state['values']['record_name'], 
    $form_state['values']['template_id'], 
    $form_state['storage']['template_array']
    );
    $new_record = ($form_state['values']['field_group'] == 'NEW') ? TRUE : FALSE;
    if ((!$is_unique) AND $new_record) {
      form_set_error('record_name', "New Record Name must be unique. '" . $form_state['values']['record_name'] . "' is not unique.");
    }
  }

}