Permalink
Browse files

Added support for events for form elements

git-svn-id: https://qooxdoo-contrib.svn.sourceforge.net/svnroot/qooxdoo-contrib@20279 09f7d036-9b2a-0410-8fbe-9cff4eb17569
  • Loading branch information...
1 parent 1005200 commit 955181f30b9c8294f557049734643d8d357e2bde cboulanger committed Jun 18, 2010
Showing with 23 additions and 0 deletions.
  1. +23 −0 source/class/dialog/Form.js
@@ -548,6 +548,29 @@ qx.Class.define("dialog.Form",
}
/*
+ * events
+ */
+ if ( qx.lang.Type.isObject( fieldData.events ) )
+ {
+ for ( var type in fieldData.events )
+ {
+ try
+ {
+ var func = eval("("+fieldData.events[type]+")"); // eval is evil, I know.
+ if ( ! qx.lang.Type.isFunction(func) )
+ {
+ throw new Exception();
+ }
+ formElement.addListener(type,func,formElement);
+ }
+ catch(e)
+ {
+ this.warn("Invalid '" + type + "' event handler for form element '" + key + "'.");
+ }
+ }
+ }
+
+ /*
* add label and form element to form
*/
var label = fieldData.label;

0 comments on commit 955181f

Please sign in to comment.