You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk> on 2008/06/30 20:31:47 UTC
AjaxButton and FancySubmitForm
Im trying to get this to work:
http://cwiki.apache.org/confluence/display/WICKET/Fancy+validation+using+AJAX%2C+alternatives+to+FeedbackPanel
However it seems the onError part are newer called, it does work when it's valid. Im using AjaxButton like this:
public class AjaxFancySubmitButton extends AjaxButton {
public AjaxFancySubmitButton(String id) {
super(id);
// TODO Auto-generated constructor stub
}
public AjaxFancySubmitButton(String id, Form form) {
super(id, form);
// TODO Auto-generated constructor stub
}
@Override
protected void onSubmit(final AjaxRequestTarget target, Form form) {
form.visitFormComponents(new IVisitor() {
public Object formComponent(IFormVisitorParticipant formVisitor) {
if (formVisitor instanceof FormComponent) {
FormComponent formComponent = (FormComponent) formVisitor;
if (!formComponent.isValid()) {
// If this component failed validation, do something
// fancy to display it to the user...
target.addComponent(formComponent);
// do a little dance
target.appendJavascript(new Effect.Shake(formComponent)
.toJavascript());
}
}
return formVisitor;
}
});
target.addComponent(form.getPage().get("feedback"));
}
--
-Wicket for love
Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org