click-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bob Schellink <sab...@gmail.com>
Subject ControlRegistry phase callbacks
Date Tue, 17 Mar 2009 06:12:33 GMT
Hi all,

We have an issue with Form where it automatically adds hidden fields, 
such as the form-name field, which can create some surprising effects 
with the insert order. For example:

form.add(field1);
form.add(field2);
form.insert(field3, 1);

It would seem that textField3 would be inserted between field1 and 
field2. However because of the hidden fields added by Form, field3 
would be inserted before field1.

We could add the hidden fields in the Form #render method instead, 
however subclasses can forget to add the hidden fields which would 
break the Form.

Since ControlRegistry supports registering multiple listeners for the 
same control, I've been thinking of introducing different "phases" 
when listeners would be fired. In the case of Form, a POST_ON_RENDER 
phase would be useful which invokes registered listeners after the 
onRender event.

So in short ControlRegistry phase callbacks would allow developers to 
register listeners (callbacks) which are guaranteed to be called and 
cannot be overridden.

For now the phases supported would be POST_RENDER and POST_PROCSES. 
POST_PROCESS is the current default which fires after controls have 
been processed.

regards

bob

Mime
View raw message