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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to