click-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bob Schellink <sab...@gmail.com>
Subject On demand binding
Date Mon, 18 Jan 2010 08:34:12 GMT
Hi all,

Thought I'd solicit some feedback on a new feature I've been pondering about the last couple
of days.

Enter On Demand Binding, the ability for a field to bind to its request parameter when needed!

Controls are bound to incoming request parameters during the onProcess phase. However often
times we 
need to know a control's value during the onInit phase, so we can perform conditional logic
such as 
adding new fields to a form.

Currently we can either bind a field value explicitly using the method #bindRequestValue,
or inspect 
the HttpRequest parameters:

public void onInit() {

   Checkbox chk = new Checkbox("chk");
   chk.bindRequestValue();  // Without On Demand Binding, we need to bind explicitly

   if (chk.isChecked()) {
     form.add(new TextField("comment"));
   }
}

The idea with On Demand Binding is that Fields should bind to its incoming request parameter
when 
needed. For example:

public void onInit() {

   Checkbox chk = new Checkbox("chk");

   if (chk.isChecked()) {
     form.add(new TextField("comment"));
   }
}


What do you think? Will this feature be useful or cause unnecessary confusion?

kind regards

bob

Mime
View raw message