function tripal_bulk_loader_import_template_form_validate

2.x tripal_bulk_loader.admin.templates.inc tripal_bulk_loader_import_template_form_validate($form, &$form_state)
3.x tripal_bulk_loader.admin.templates.inc tripal_bulk_loader_import_template_form_validate($form, &$form_state)

Validates the import template form

File

tripal_bulk_loader/includes/tripal_bulk_loader.admin.templates.inc, line 730
All functions in this file pertain to administrative management of bulk loader templates

Code

function tripal_bulk_loader_import_template_form_validate($form, &$form_state) {

  $options = array(
    'template_name' => trim($form_state['values']['template_name']),
    'template_array' => trim($form_state['values']['template_array'])
  );
  $errors = array();
  $warnings = array();

  // Use the API function to Validate the submission.
  tripal_validate_bulk_loader_template('insert', $options, $errors, $warnings);

  // Now set form errors if any errors were detected.
  if (count($errors) > 0) {
    foreach ($errors as $field => $message) {
      form_set_error($field, $message);
    }
  }
  // Add any warnings if any were detected
  if (count($warnings) > 0) {
    foreach ($warnings as $field => $message) {
      drupal_set_message($message, 'warning');
    }
  }
}