rules declaration for form valdation

2010-07-20 Thread Jan Juno
How can I avoid if hell?

and declare rules for my form validation. I have project which has an
extensive form on which when you check on chceck box than this and this will
be disabled this is enabled, and so on. In the end you end up with huge if
else if else.

How can I avoid it in wicket?


Re: rules declaration for form valdation

2010-07-20 Thread jcgarciam

if you can just avoid push operation (if. setThatcomponentEnabled ...else
setThatComponentDisable).

Use a Pull approach, override the isEnabled of your component and make it
query the boolean value of your model.

i.e::

form.add(new TextField(myId){
public boolean isEnabled(){
 return ((MyObject)getModelObject()).getMyBooleanProperty();
}
});


On Tue, Jul 20, 2010 at 12:01 PM, Jan Juno [via Apache Wicket] 
ml-node+2295636-518553383-229...@n4.nabble.comml-node%2b2295636-518553383-229...@n4.nabble.com
 wrote:

 How can I avoid if hell?

 and declare rules for my form validation. I have project which has an
 extensive form on which when you check on chceck box than this and this
 will
 be disabled this is enabled, and so on. In the end you end up with huge if
 else if else.

 How can I avoid it in wicket?


 --
  View message @
 http://apache-wicket.1842946.n4.nabble.com/rules-declaration-for-form-valdation-tp2295636p2295636.html
 To unsubscribe from Apache Wicket, click 
 herehttp://apache-wicket.1842946.n4.nabble.com/subscriptions/Unsubscribe.jtp?code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDExOTE5MDc4OTQ=.





-- 
Sincerely,
JC

Work smarter, not harder!.

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/rules-declaration-for-form-valdation-tp2295636p2295697.html
Sent from the Wicket - User mailing list archive at Nabble.com.