Ticket #204 (closed enhancement: fixed)

Opened 4 years ago

Last modified 3 years ago

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:1 Changed 4 years ago by mpo

First stab at this in [1221]

Remaining work:

  • updating docs
  • checking for current controls that no longer need a fake <div> 'input' element to be sending events.

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

comment:3 Changed 3 years ago by jgou

  • Owner changed from mpo to freya
  • Component changed from modules/kauri-forms to < Builder Logic

comment:4 Changed 3 years ago by mpo

  • Status changed from new to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.