You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bf...@apache.org on 2012/08/23 20:11:14 UTC

[2/2] git commit: UI create form: Support custom checkbox 'on change' event

UI create form: Support custom checkbox 'on change' event

If field is a checkbox (isBoolean: true) and onChange function is
specified, then call this onChange everytime checkbox is clicked.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/7e3b4408
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/7e3b4408
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/7e3b4408

Branch: refs/heads/master
Commit: 7e3b4408cb2066f47537e486cd0a6e89bfa80826
Parents: b5d0072
Author: Brian Federle <br...@citrix.com>
Authored: Thu Aug 23 10:55:21 2012 -0700
Committer: Brian Federle <br...@citrix.com>
Committed: Thu Aug 23 11:08:12 2012 -0700

----------------------------------------------------------------------
 ui/scripts/ui/dialog.js |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7e3b4408/ui/scripts/ui/dialog.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui/dialog.js b/ui/scripts/ui/dialog.js
index 86db690..88ffe57 100644
--- a/ui/scripts/ui/dialog.js
+++ b/ui/scripts/ui/dialog.js
@@ -273,6 +273,15 @@
               }, 100);
             }
           }
+
+          // Setup on click event
+          if (field.onChange) {
+            $input.click(function() {
+              field.onChange({
+                $checkbox: $input
+              });
+            });
+          }
         } else if (field.dynamic) {
           // Generate a 'sub-create-form' -- append resulting fields
           $input = $('<div>').addClass('dynamic-input').appendTo($value);