+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 <[email protected]> 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 >
