function chado_add_node_form_dbxrefs_add_button_validate

2.x tripal_core.chado_nodes.dbxrefs.api.inc chado_add_node_form_dbxrefs_add_button_validate($form, &$form_state)
3.x tripal_core.chado_nodes.dbxrefs.api.inc chado_add_node_form_dbxrefs_add_button_validate($form, &$form_state)

Validate the user input for creating a new dbxref Called by the add button in chado_add_node_form_dbxrefs

1 call to chado_add_node_form_dbxrefs_add_button_validate()
chado_add_node_form_subtables_add_button_validate in legacy/tripal_core/api/tripal_core.chado_nodes.api.inc
Validate Adding Subtables entries from the node forms. Supported subtables: Properties, Relationships, Additional DBxrefs.

File

legacy/tripal_core/api/tripal_core.chado_nodes.dbxrefs.api.inc, line 441
API to manage the Chado dbxref table for various Tripal Node Types

Code

function chado_add_node_form_dbxrefs_add_button_validate($form, &$form_state) {

  // Ensure the db_id is supplied & Valid
  $db = chado_select_record(
  'db', 
  array('db_id', 'name'), 
  array('db_id' => $form_state['values']['dbxref_table']['new']['db'])
  );
  if (!isset($db[0])) {
    form_set_error('dbxref_table][new][db', 'Please select a database before attempting to add a new database reference.');
  }
  else {
    $form_state['values']['dbxref_table']['new']['db_name'] = $db[0]->name;
  }

  // Ensure accession is supplied
  if (empty($form_state['values']['dbxref_table']['new']['dbxref_accession'])) {
    form_set_error('dbxref_table][new][dbxref_accession', 'You must enter the accession before attempting to add a new database reference.');
  }

}