Anna, I think James literally meant this presentation, it's got the code snippets you want: http://londonwicket.googlecode.com/files/LondonWicket-FormsWithFlair.pdf
-R On Thu, Feb 4, 2010 at 12:25 PM, Anna Simbirtsev <[email protected]>wrote: > Can you give an example please? > Actually I am validating uniqueness of the name, i just put the length as > an > example. > But if you could give me an example of how to change the class using a > behaviour, that would be nice. > > On Thu, Feb 4, 2010 at 2:20 PM, James Carman > <[email protected]>wrote: > > > It's better to use a validator for this. And, you can add a behavior > > (look at forms with flair presentation) to change the class (I would > > do that instead of in-lining the style) of the components in error. > > > > On Thu, Feb 4, 2010 at 2:05 PM, Anna Simbirtsev <[email protected]> > > wrote: > > > Hi, > > > > > > I am validating a field(user presses validation button) and if its > > invalid I > > > highlight the field in the following way: > > > > > > AjaxSubmitLink checkName = new AjaxSubmitLink("check_name", form) { > > > > > > public void onSubmit(AjaxRequestTarget target, Form<?> form) { > > > if (name.length() < 5) { > > > name.add(new SimpleAttributeModifier( > > "style", > > > "color:red;border-color:red;")); > > > target.addComponent(domain_name); > > > } > > > } > > > } > > > > > > Then when the user modifies the name field, I need to remove the red > > color > > > from the field. > > > Is it better to do it with behaviour and look for onchange event? If > yes, > > > which one? > > > > > > Thank you > > > Anna > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [email protected] > > For additional commands, e-mail: [email protected] > > > > > > > -- > Anna Simbirtsev > (416) 729-7331 >
