function tripal_pub_remote_validate_form_PMID

2.x tripal_pub.PMID.inc tripal_pub_remote_validate_form_PMID($form, $form_state)
3.x tripal_chado.pub_importer_PMID.inc tripal_pub_remote_validate_form_PMID($form, $form_state)
1.x PMID.inc tripal_pub_remote_validate_form_PMID($form, $form_state)

File

tripal_pub/includes/importers/PMID.inc, line 26
Tripal Pub PubMed Interface

Code

function tripal_pub_remote_validate_form_PMID($form, $form_state) {
  $num_criteria = $form['num_criteria']['#default_value'];

  for ($i = 1; $i <= $num_criteria; $i++) {
    $search_terms = trim($form_state['values']["search_terms-$i"]);
    $scope = $form_state['values']["scope-$i"];
    if ($scope == 'id' and !preg_match('/^PMID:\d+$/', $search_terms)) {
      form_set_error("search_terms-$i", "The PubMed accession must be a numeric value, prefixed with 'PMID:' (e.g. PMID:23024789).");
    }
  }
  return $form;
}