Ticket #204 (closed enhancement: fixed)
Consider dropping the required input role element, do event handling using a normal js object
| Reported by: | bruno | Owned by: | freya |
|---|---|---|---|
| Priority: | major | Milestone: | 0.4 |
| Component: | < Builder Logic | Version: | trunk |
| Keywords: | Cc: |
Description
Currently Kauri Forms requires to have a HTML element playing the "input" role. This element is used as event hub, for registering or triggering events you need to do something like:
control.getElement().someEvent();
Besides the event sutff, there seems to be no other reason in the control base class to really require the input role element.
For some controls, it simply does not make sense to have an input role element. One can of course create a fake one (a non-displayed div e.g.).
Here's some example code illustrating that jQuery can work with any plain javascript object for binding/triggering events.
var object = {};
var $object = $(object);
$object.bind('myEvent', function() {
alert("hi there 1");
});
$object.bind('myEvent', function() {
alert("hi there 2");
});
$object.trigger('myEvent');
$(object).trigger('myEvent');
Change History
comment:2 Changed 4 years ago by mpo
See also a sidewise related discussion about how to create HTML bound to controls in http://groups.google.com/group/kauri-discuss/browse_thread/thread/64005d96be90fca9
First stab at this in [1221]
Remaining work: