click-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Malcolm Edgar <malcolm.ed...@gmail.com>
Subject Re: On demand binding
Date Mon, 18 Jan 2010 12:23:29 GMT
+1 I think this is a good idea, so long as the fields parent form
submit status is respected, i.e. if a page has two forms only fields
belonging to the submitted form should be able to bind their fields.

regards Malcolm Edgar

On Mon, Jan 18, 2010 at 7:34 PM, Bob Schellink <sabob1@gmail.com> wrote:
> 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