function tripal_admin_data_collection_form_validate

3.x tripal.admin.inc tripal_admin_data_collection_form_validate($form, &$form_state)

Validate function for the tripal_admin_data_collection_form form.

File

tripal/includes/tripal.admin.inc, line 43

Code

function tripal_admin_data_collection_form_validate($form, &$form_state) {
  $enable = $form_state['values']['enabled'];
  $lifespan = $form_state['values']['lifespan'];

  if (!preg_match('/^\d+$/', $lifespan)) {
    form_set_error('filespan', 'Please provide a valid numeric value for the number of hours collections exist.');
  }
  else {
    if ($lifespan == 0) {
      form_set_error('filespan', 'Please provide a positive numeric value for the number of hours collections exist.');
    }
  }
}