function tripal_views_integration_form_validate

2.x tripal_views_integration_UI.inc tripal_views_integration_form_validate($form, &$form_state)
1.x tripal_views_integration.inc tripal_views_integration_form_validate($form, &$form_state)

Purpose: validates the tripal_views_integration_form after submission

Parameters

$form: The form object which is passed automatically by drupal

$form_state: The form state pbject which is passed automatically by drupal

File

tripal_views/includes/tripal_views_integration.inc, line 800
Functions related to the UI for integrating tables with views

Code

function tripal_views_integration_form_validate($form, &$form_state) {
  $name_array = explode(" ", $form_state['values']['row_name']);
  $mview_id = $form_state['values']['mview_id'];
  $table_name = $form_state['values']['table_name'];

  //  if (count($name_array) > 1) {
  //    form_set_error($form_state['values']['row_name'], 'The View type name must be a single word only.');
  //  }
  if ($mview_id and $table_name) {
    form_set_error('mview_id', 'Please select either a materialized view or a Chado table but not both');
  }
  if (!$mview_id and !$table_name) {
    form_set_error('mview_id', 'Please select either a materialized view or a Chado table');
  }

  // Ensure that users don't override the default integrations
  if ($form_state['values']['row_priority'] >= 9) {
    form_set_error('row_priority', 'A priority of 10 or 9 is reserved for default tripal '
      . 'views integrations created by core modules. Please set the priority between '
      . '0 and -10 to ensure your changes are used rather over the defaults.');
  }
  // TODO: do we need to require that a handler be set for each field and each type of handler?
}