From 4edb2e6cd71ab74da4341c8eae0e5e543ee21017 Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Thu, 23 Aug 2012 10:55:21 -0700 Subject: [PATCH] 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. reviewed-by: jessica --- ui/scripts/ui/dialog.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ui/scripts/ui/dialog.js b/ui/scripts/ui/dialog.js index 50c4ed77b6a..e8536aacf8e 100644 --- a/ui/scripts/ui/dialog.js +++ b/ui/scripts/ui/dialog.js @@ -261,6 +261,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 = $('
').addClass('dynamic-input').appendTo($value);