Tripal Plant PopGen Submit
front.php
Go to the documentation of this file.
1 <?php
2 
16 function tpps_front_page_validate_form(array &$form, array &$form_state) {
17  if ($form_state['submitted']) {
18  if (tpps_access('administer tpps module') and !empty($form_state['values']['custom_accession_check'])) {
19  if (!preg_match('/^TGDR\d{3,}$/', $form_state['values']['custom_accession'])) {
20  form_set_error('custom_accession', "The accession number {$form_state['values']['custom_accession']} is invalid.");
21  }
22  else {
23  $result = chado_select_record('dbxref', array('accession'), array(
24  'accession' => $form_state['values']['custom_accession'],
25  ), array(
26  'limit' => 1,
27  ));
28  if (!empty($result)) {
29  form_set_error('custom_accession', "The accession number {$form_state['values']['custom_accession']} is already in use.");
30  }
31  }
32  }
33  }
34 }
tpps_front_page_validate_form(array &$form, array &$form_state)
Definition: front.php:16
tpps_access()
Definition: tpps.module:341