Re: [Wicket-user] Input Field background color change on validation

2007-01-15 Thread Cliff Pereira
Hi, first of all. Thanks for your help. This version seems much easier and clearer to me. But still I do not now where to validate the input of the field. Should I use the wicket validators? I'm not so familiar with that. Would be kind, if you could give me one or two more hints! The models

Re: [Wicket-user] Input Field background color change on validation

2007-01-15 Thread Erik van Oosten
Hi Cliff, You can look on the Wiki: http://cwiki.apache.org/WICKET/forms.html The wicket-examples probably have some eh, examples. The basic thing is to call formfield#add(IValidator). Have fun, Erik. Cliff Pereira wrote: Hi, first of all. Thanks for your help. This version seems much

[Wicket-user] Input Field background color change on validation

2007-01-14 Thread Cliff Pereira
Hello Mailinglist again, I tried to implement a simple input field where you can e.g. enter your username. Now I want to let the background of the textfield be red while it is not valid. And if it's finally valid it should change to green (during the input). My problem is, that I always loose

Re: [Wicket-user] Input Field background color change on validation

2007-01-14 Thread Martijn Dashorst
You make it very complicated :-) final TextField uname = new TextField(username, ...).add(new AttributeModifier(class, true, new Model() { public void getObject(Component c) { return uname.isValid() ? valid : invalid; } }); uname.add(new AjaxFormComponentUpdateBehavior(onblur) { public void

Re: [Wicket-user] Input Field background color change on validation

2007-01-14 Thread Erik van Oosten
Hi Cliff, If I read your requirements correctly you should use onkeypress instead of onblur. But I guess you already guessed that. Regards, Erik. Martijn Dashorst wrote: You make it very complicated :-) final TextField uname = new TextField(username, ...).add(new