Tripal Plant PopGen Submit
front.php File Reference

Go to the source code of this file.

Functions

 tpps_front_page_validate_form (array &$form, array &$form_state)
 

Detailed Description

Defines the data integrity checks for the form landing page.

Definition in file front.php.

Function Documentation

◆ tpps_front_page_validate_form()

tpps_front_page_validate_form ( array &  $form,
array &  $form_state 
)

Defines the data integrity checks for the form landing page.

Parameters
array$formThe form that is being validated.
array$form_stateThe state of the form that is being validated.

Definition at line 16 of file front.php.

16  {
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_access()
Definition: tpps.module:341