Thanks for the information.

But if I don't have an Ajax button but a normal Button which submits the form? 

There is no target "variable" in the onValidate() method. 


I attached a quickstart earlier, where I showed that if I use Ajax 
onblur/onchange and use onError/onUpdate there

i nor problem of showing the error but when I the later click the "submit" 
button the error is NOT displayed

when they validator "kicks in". 

 

/Kenneth

 
> From: russellsimpk...@hotmail.com
> To: users@wicket.apache.org
> Subject: RE: error(validatable)
> Date: Sat, 18 Jul 2009 07:47:45 -0400
> 
> 
> Kenneth, 
> I over rode onError when I used the ComponentFeedbackPanel - when learning 
> Wicket, I discovered that I had no idea my form errored out unless I did the 
> following for my form. In this instance, I'm using the AjaxButton. I think 
> the key is to add your feedback component to the target.
> 
> /** * Always, always add this - its much better to know there was an error. * 
> @see 
> org.apache.wicket.ajax.markup.html.form.AjaxButton#onError(org.apache.wicket.ajax.AjaxRequestTarget,
>  org.apache.wicket.markup.html.form.Form) */@Overrideprotected void 
> onError(AjaxRequestTarget target, Form tform) { super.onError(target, tform); 
> form.error("Please make sure you have filled in all required fields."); // 
> add the feedback - seems you have to do this to give feedback on errors. 
> target.addComponent(emailFeedback); ....}
> 
> > From: rinoc...@live.se
> > To: users@wicket.apache.org
> > Subject: error(validatable)
> > Date: Sat, 18 Jul 2009 12:32:46 +0200
> > 
> > 
> > 
> > 
> > Let's rephrase my problem.
> > 
> > 
> > 
> > I connect a validator to a TextField in a DataView (inside populateItem() 
> > and connect a ComponentFeedbackPanel to it.
> > 
> > 
> > final TextField tf = new TextField("data", new PropertyModel(row, "data"));
> > final ComponentFeedbackPanel tfFeedback = new ComponentFeedbackPanel("fb", 
> > tf);
> > tfFeedback.setOutputMarkupId(true);
> > item.add(tf);
> > item.add(tfFeedback);
> > 
> > And I also have both in the HTML markup
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > Is this enough for the error reported in in onValidate() for the validator 
> > connected to the field 
> > 
> > with error(ivalidatable); should be displayed next to the field or does it 
> > require something more?
> > 
> > 
> > 
> > error(validatable, "an_error_occured");
> > 
> > 
> > Why I wonder is that it is not displayed next to the field, it is displayed 
> > in the "common" feedback panel.
> > 
> > 
> > 
> > /Kenneth
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > _________________________________________________________________
> > Med Windows Live kan du ordna, redigera och dela med dig av dina foton.
> > http://www.microsoft.com/sverige/windows/windowslive/products/photo-gallery-edit.aspx
> 
> _________________________________________________________________
> Bing™ brings you maps, menus, and reviews organized in one place. Try it now.
> http://www.bing.com/search?q=restaurants&form=MLOGEN&publ=WLHMTAG&crea=TXT_MLOGEN_Local_Local_Restaurants_1x1
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 

_________________________________________________________________
Med Windows Live kan du ordna, redigera och dela med dig av dina foton.
http://www.microsoft.com/sverige/windows/windowslive/products/photo-gallery-edit.aspx

Reply via email to