Author: sevein
Date: Wed Aug  1 15:11:19 2012
New Revision: 12027

Log:
Call to a validator if it is available

Modified:
   trunk/js/dialog.js

Modified: trunk/js/dialog.js
==============================================================================
--- trunk/js/dialog.js  Wed Aug  1 15:03:05 2012        (r12026)
+++ trunk/js/dialog.js  Wed Aug  1 15:11:19 2012        (r12027)
@@ -94,7 +94,17 @@
         var handleYuiSubmit = function ()
           {
             this.hide(); // Hide dialog
-            thisDialog.submit(this.getData()); // Save dialog data
+
+            var data = this.getData();
+
+            // The validator must return false to cancel the operation
+            if ('undefined' !== typeof thisDialog.options.validator
+                && false === thisDialog.options.validator.call(this, data))
+            {
+              return false;
+            };
+
+            thisDialog.submit(data); // Save dialog data
           }
 
         var handleYuiCancel = function ()
@@ -112,7 +122,6 @@
           visible: false,
           zIndex: 20000 });
 
-
         // Render TabView from markup if exists (for example: 
relatedContactInformation)
         var $tabview = $yuiDialogWrapper.find('.yui-navset');
         if ($tabview.length)
@@ -534,7 +543,7 @@
             var rowId = this.id;
             var $row = $(displayTable).find('tbody > tr').filter(function()
               {
-                return rowId == this.id; 
+                return rowId == this.id;
               });
             if (!$row.length)
             {

-- 
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/qubit-commits?hl=en.

Reply via email to