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]
