Thanks for your reply,

> Argh, confused setVisible() with setRequired, my bad ;-)
> But nevertheless: call setRequiered(condition) in onConfigure().

I've tried this but if I am correct isRequired() gets called before 
onConfigure() during the request cycle (at least this is the behaviour I see 
during debugging). 

The problem is that the user is then able to submit the form without filling in 
the required field if validation completely succeeds at once. Also the required 
fields "lag" behind one request cycle.

>    -Tom
> Thomas Götz wrote:
> > Yes, you can also push the state instead of pulling it, which besides is
> preferrable in terms of efficiency (as onConfigure() is only called once per
> request whereas isVisible() is potentially called many time):
> >
> > TextField<String> textField = new TextField<String>("textField") {
> >    @Override
> >    protected void onConfigure() {
> >        super.onConfigure();
> >        setVisible(condition);
> >    }
> > };
> >
> > You can also call textField.setVisible(...) in the Page's or Panel's
> onConfigure(), but then you need a reference to the textField (property of the
> page or panel). Or - if possible - you can group your FormComponents into a
> WebMarkupContainer an set the visibility there.
> >
> >   -Tom
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

Think green - keep it on the screen.

This e-mail and any attachment is for authorised use by the intended 
recipient(s) only. It may contain proprietary material, confidential 
information and/or be subject to legal privilege. It should not be copied, 
disclosed to, retained or used by, any other party. If you are not an intended 
recipient then please promptly delete this e-mail and any attachment and all 
copies and inform the sender. Thank you.

To unsubscribe, e-mail:
For additional commands, e-mail:

Reply via email to