function chado_add_node_form_dbxrefs_add_button_validate

2.x 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

Related topics

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


tripal_core/api/, line 443
API to manage the chado _dbxref table for various Tripal Node Types


function chado_add_node_form_dbxrefs_add_button_validate($form, &$form_state) {

  // Ensure the db_id is supplied & Valid
  $db = chado_select_record(
  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.');