Browse Source

Small change to Chado Node Validation: Now only validate on save (instead of just skipping on delete this also skips on AJAX submission).

Lacey Sanderson 10 years ago
parent
commit
e8da7fddb9

+ 5 - 2
tripal_analysis/includes/tripal_analysis.chado_node.inc

@@ -290,8 +290,11 @@ function chado_analysis_validate($node, $form, &$form_state) {
  */
 function tripal_analysis_validate($node, $form, &$form_state) {
 
-  // if this is a delete then don't validate
-  if($node->op == 'Delete') {
+  // We only want to validate when the node is saved.
+  // Since this validate can be called on AJAX and Deletion of the node
+  // we need to make this check to ensure queries are not executed
+  // without the proper values.
+  if($node->op != 'Save') {
     return;
   }
 

+ 6 - 2
tripal_contact/includes/tripal_contact.chado_node.inc

@@ -245,8 +245,12 @@ function chado_contact_form(&$node, $form_state) {
  * @ingroup tripal_contact
  */
 function chado_contact_validate($node, $form, &$form_state) {
-  // if this is a delete then don't validate
-  if($node->op == 'Delete') {
+
+  // We only want to validate when the node is saved.
+  // Since this validate can be called on AJAX and Deletion of the node
+  // we need to make this check to ensure queries are not executed
+  // without the proper values.
+  if($node->op != 'Save') {
     return;
   }
 

+ 5 - 2
tripal_example/includes/tripal_example.chado_node.inc

@@ -290,8 +290,11 @@ function chado_example_form($node, &$form_state) {
  */
 function chado_example_validate($node, $form, &$form_state) {
 
-  // if this is a delete then don't validate
-  if($node->op == 'Delete') {
+  // We only want to validate when the node is saved.
+  // Since this validate can be called on AJAX and Deletion of the node
+  // we need to make this check to ensure queries are not executed
+  // without the proper values.
+  if($node->op != 'Save') {
     return;
   }
 

+ 5 - 2
tripal_feature/includes/tripal_feature.chado_node.inc

@@ -264,8 +264,11 @@ function chado_feature_form($node, &$form_state) {
  */
 function chado_feature_validate($node, $form, &$form_state) {
 
-  // if this is a delete then don't validate
-  if($node->op == 'Delete') {
+  // We only want to validate when the node is saved.
+  // Since this validate can be called on AJAX and Deletion of the node
+  // we need to make this check to ensure queries are not executed
+  // without the proper values.
+  if($node->op != 'Save') {
     return;
   }
 

+ 5 - 2
tripal_featuremap/includes/tripal_featuremap.chado_node.inc

@@ -155,8 +155,11 @@ function chado_featuremap_form($node, &$form_state) {
  */
 function chado_featuremap_validate($node, $form, &$form_state) {
 
-  // if this is a delete then don't validate
-  if($node->op == 'Delete') {
+  // We only want to validate when the node is saved.
+  // Since this validate can be called on AJAX and Deletion of the node
+  // we need to make this check to ensure queries are not executed
+  // without the proper values.
+  if($node->op != 'Save') {
     return;
   }
 

+ 6 - 2
tripal_library/includes/tripal_library.chado_node.inc

@@ -217,8 +217,12 @@ function chado_library_form($node, &$form_state) {
  * @ingroup tripal_library
  */
 function chado_library_validate($node, $form, &$form_state) {
-  // if this is a delete then don't validate
-  if($node->op == 'Delete') {
+
+  // We only want to validate when the node is saved.
+  // Since this validate can be called on AJAX and Deletion of the node
+  // we need to make this check to ensure queries are not executed
+  // without the proper values.
+  if($node->op != 'Save') {
     return;
   }
 

+ 6 - 2
tripal_organism/includes/tripal_organism.chado_node.inc

@@ -215,8 +215,12 @@ function chado_organism_form($node, $form_state) {
  * @ingroup tripal_organism
  */
 function chado_organism_validate($node, $form, &$form_state) {
-  // if this is a delete then don't validate
-  if($node->op == 'Delete') {
+
+  // We only want to validate when the node is saved.
+  // Since this validate can be called on AJAX and Deletion of the node
+  // we need to make this check to ensure queries are not executed
+  // without the proper values.
+  if($node->op != 'Save') {
     return;
   }
 

+ 5 - 2
tripal_project/includes/tripal_project.chado_node.inc

@@ -197,8 +197,11 @@ function chado_project_form(&$node, $form_state) {
  */
 function chado_project_validate($node, $form, &$form_state) {
 
-  // if this is a delete then don't validate
-  if($node->op == 'Delete') {
+  // We only want to validate when the node is saved.
+  // Since this validate can be called on AJAX and Deletion of the node
+  // we need to make this check to ensure queries are not executed
+  // without the proper values.
+  if($node->op != 'Save') {
     return;
   }
 

+ 5 - 2
tripal_pub/includes/tripal_pub.chado_node.inc

@@ -333,8 +333,11 @@ function chado_pub_form($node, $form_state) {
  */
 function chado_pub_validate($node, $form, &$form_state) {
 
-  // if this is a delete then don't validate
-  if($node->op == 'Delete') {
+  // We only want to validate when the node is saved.
+  // Since this validate can be called on AJAX and Deletion of the node
+  // we need to make this check to ensure queries are not executed
+  // without the proper values.
+  if($node->op != 'Save') {
     return;
   }
 

+ 5 - 2
tripal_stock/includes/tripal_stock.chado_node.inc

@@ -319,8 +319,11 @@ function chado_stock_form($node, $form_state) {
  */
 function chado_stock_validate(&$node, $form, &$form_state) {
 
-  // if this is a delete then don't validate
-  if($node->op == 'Delete') {
+  // We only want to validate when the node is saved.
+  // Since this validate can be called on AJAX and Deletion of the node
+  // we need to make this check to ensure queries are not executed
+  // without the proper values.
+  if($node->op != 'Save') {
     return;
   }