You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by SunPrairieDude <mu...@hotmail.com> on 2008/12/14 07:11:49 UTC

Ajax Validation of TextField yields Duplicate Messages

Hi,

I am trying to validate a TextField via Ajax during the onchange event. I
use a custom behavior (ValidationBehavior) to display a custom styled error
whenever the validation fails. What I am noticing is that the error message
that was displayed from a previous Ajax validation does not get wiped out
and instead the new message tags on to the previous one while displaying on
the browser. Can anybody tell me what am I doing wrong here? I am using
Wicket 1.4 RC1.

                final RequiredTextField<String> state = new
RequiredTextField<String>("address.state");
		state.add(new StateValidator());
                state.add(new ValidationBehavior());
		state.setOutputMarkupId(true);
		state.add(new AjaxFormComponentUpdatingBehavior("onchange")	{
			private static final long serialVersionUID = 1L;

			@Override
			protected void onUpdate(AjaxRequestTarget target) {
				//NO OP
			}
			
			@Override
			protected void onError(final AjaxRequestTarget target, RuntimeException
e) {
				super.onError(target,e);
				target.addComponent(state);
				target.focusComponent(getComponent());
			}
		});
		form.add(state);

Thanks
Murali
-- 
View this message in context: http://www.nabble.com/Ajax-Validation-of-TextField-yields-Duplicate-Messages-tp20997678p20997678.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org