fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [10835] Functionality for validating controller item


From: Torstein
Subject: [Fmsystem-commits] [10835] Functionality for validating controller item case
Date: Thu, 14 Feb 2013 14:22:53 +0000

Revision: 10835
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10835
Author:   vator
Date:     2013-02-14 14:22:52 +0000 (Thu, 14 Feb 2013)
Log Message:
-----------
Functionality for validating controller item case

Modified Paths:
--------------
    trunk/controller/js/controller/case.js

Modified: trunk/controller/js/controller/case.js
===================================================================
--- trunk/controller/js/controller/case.js      2013-02-14 12:57:59 UTC (rev 
10834)
+++ trunk/controller/js/controller/case.js      2013-02-14 14:22:52 UTC (rev 
10835)
@@ -13,7 +13,10 @@
     
     $(thisForm).find("input[name=location_code]").val(location_code);
     
-               $.ajax({
+    var validate_status = validate_form( thisForm );
+    
+    if( validate_status ){
+      $.ajax({
                          type: 'POST',
                          url: requestUrl + "&" + $(thisForm).serialize(),
                          success: function(data) {
@@ -43,6 +46,7 @@
                                  }
                                }
                });
+    }
        });
 
        // UPDATE CASE
@@ -252,4 +256,28 @@
        });     
 });
 
+function validate_form( formObj )
+{
+  var status = true;
+  
+  $(formObj).find(".input_error_msg").remove();
+  
+  $(formObj).find(":input.required").each(function() {
+    var thisInput = $(this);
 
+    if( $(thisInput).val() == '' )
+    {
+      if( $(thisInput).attr("type") == 'hidden' )
+      {
+               $(formObj).prepend("<div class='input_error_msg'>Du må velge 
bygg</div>");   
+      }else
+      {
+        $(thisInput).before("<div class='input_error_msg'>Du må fylle ut dette 
feltet</div>");  
+      }
+      
+      status = false;
+    }
+  });
+  
+  return status;
+}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]