[CONF] Apache Wicket: Fancy validation using AJAX, alternatives to FeedbackPanel (page edited)

2006-12-04 Thread confluence










Page Edited :
WICKET :
Fancy validation using AJAX, alternatives to FeedbackPanel



 
Fancy validation using AJAX, alternatives to FeedbackPanel
has been edited by Jeremy Levy
(Dec 04, 2006).
 

 
 (View changes)
 

Content:
If you want to have a more "web 2.0" validation on your forms here is a quick way to do it:

Using the Wicket Example: Ajax Builtin: FormPage as a base, the onError method is called if any of your validators fail, in there you need to view the children components attached to your form and check the isValid() method on each one to determine if that component passed validation.  A really easy to do this is the following:

 protected void onError(final AjaxRequestTarget target, Form form) {
 
    log.debug("onError called");

    form.visitFormComponents(new FormComponent.IVisitor() {
    
    public void formComponent(FormComponent formComponent) {
    log.debug("Checking: "  + formComponent.getMarkupId() + " " + formComponent.isValid());
    
    if (!formComponent.isValid()){ // If this component failed validation, do something fancy to display it to the user...
    target.addComponent(formComponent);
    target.appendJavascript("new Effect.Shake($('" + formComponent.getMarkupId() + "'));");
    }
    
    }
    });
    }

The above example also adds in _javascript_ effects borrowed from the Effects example using the script.aculo.us library.











Powered by
Atlassian Confluence
(Version: 2.2.9 Build:#527 Sep 07, 2006)
-
Bug/feature request

Unsubscribe or edit your notifications preferences








[CONF] Apache Wicket: Fancy validation using AJAX, alternatives to FeedbackPanel (page edited)

2006-12-04 Thread confluence










Page Edited :
WICKET :
Fancy validation using AJAX, alternatives to FeedbackPanel



 
Fancy validation using AJAX, alternatives to FeedbackPanel
has been edited by Jeremy Levy
(Dec 04, 2006).
 

 
 (View changes)
 

Content:
If you want to have a more "web 2.0" validation on your forms here is a quick way to do it:

Using the Wicket Example: Ajax Builtin: FormPage as a base, the onError method is called if any of your validators fail, in there you need to view the children components attached to your form and check the isValid() method on each one.  A really easy to do this is the following:

    protected void onError(final AjaxRequestTarget target, Form form) {
   
    log.warn("onError Called");

                        // Safe way to view the children components...
    form.visitFormComponents(new FormComponent.IVisitor() {
   
    public void formComponent(FormComponent formComponent) {
                        log.debug("Checking: "  + formComponent.getMarkupId() + " " + formComponent.isValid());
   
    if (!formComponent.isValid())Unknown macro: {
 target.addComponent(formComponent); 
target.appendJavascript("new Effect.Shake($(" + formComponent.getMarkupId() + "));"); 
   
    } 
    });
    }
The above example also adds in _javascript_ effects borrowed from the Effects example using the script.aculo.us library.











Powered by
Atlassian Confluence
(Version: 2.2.9 Build:#527 Sep 07, 2006)
-
Bug/feature request

Unsubscribe or edit your notifications preferences








[CONF] Apache Wicket: Fancy Validation using AJAX, Alternatives to FeedbackPanel (page edited)

2006-12-04 Thread confluence










Page Edited :
WICKET :
Fancy Validation using AJAX, Alternatives to FeedbackPanel



 
Fancy Validation using AJAX, Alternatives to FeedbackPanel
has been edited by Jeremy Levy
(Dec 04, 2006).
 

 
 (View changes)
 

Content:
If you want to have a more "web 2.0" validation on your forms here is a quick way to do it:

Using the Wicket Example: Ajax Builtin: FormPage as a base, the onError method is called if any of your validators fail, in there you need to view the children components attached to your form and check the isValid() method on each one.  A really easy to do this is the following:

    protected void onError(final AjaxRequestTarget target, Form form) {
   
    log.warn("onError Called");

                        // Safe way to view the children components...
    form.visitFormComponents(new FormComponent.IVisitor() {
   
    public void formComponent(FormComponent formComponent) {
                        log.debug("Checking: "  + formComponent.getMarkupId() + " " + formComponent.isValid());
   
    if (!formComponent.isValid())Unknown macro: {
 target.addComponent(formComponent); 
target.appendJavascript("new Effect.Shake($(" + formComponent.getMarkupId() + "));"); 
   
    } 
    });
    }
The above example also adds in _javascript_ effects borrowed from the Effects example using the script.aculo.us library.











Powered by
Atlassian Confluence
(Version: 2.2.9 Build:#527 Sep 07, 2006)
-
Bug/feature request

Unsubscribe or edit your notifications preferences








[CONF] Apache Wicket: Fancy Validation using AJAX, Alternatives to FeedbackPanel (page edited)

2006-12-04 Thread confluence










Page Edited :
WICKET :
Fancy Validation using AJAX, Alternatives to FeedbackPanel



 
Fancy Validation using AJAX, Alternatives to FeedbackPanel
has been edited by Jeremy Levy
(Dec 04, 2006).
 

 
 (View changes)
 

Content:
If you want to have a more "web 2.0" validation on your forms here is a quick way to do it:

Using the Wicket Example: Ajax Builtin: FormPage as a base, the onError method is called if any of your validators fail, in there you need to view the children components attached to your form and check the isValid() method on each one.  A really easy to do this is the following:

    protected void onError(final AjaxRequestTarget target, Form form) {
   
    log.warn("onError Called");

                        // Safe way to view the children components...
    form.visitFormComponents(new FormComponent.IVisitor() {
   
    public void formComponent(FormComponent formComponent) {
                        log.debug("Checking: "  + formComponent.getMarkupId() + " " + formComponent.isValid());
   
    if (!formComponent.isValid())
Unknown macro: { target.addComponent(formComponent); target.appendJavascript("new Effect.Shake($(" + formComponent.getMarkupId() + "));"); } 
   
    }
    });
    }
The above example also adds in _javascript_ effects borrowed from the Effects example using the script.aculo.us library.











Powered by
Atlassian Confluence
(Version: 2.2.9 Build:#527 Sep 07, 2006)
-
Bug/feature request

Unsubscribe or edit your notifications preferences








[CONF] Apache Wicket: Fancy Validation using AJAX, Alternatives to FeedbackPanel (page edited)

2006-12-04 Thread confluence










Page Edited :
WICKET :
Fancy Validation using AJAX, Alternatives to FeedbackPanel



 
Fancy Validation using AJAX, Alternatives to FeedbackPanel
has been edited by Jeremy Levy
(Dec 04, 2006).
 

 
 (View changes)
 

Content:
If you want to have a more "web 2.0" validation on your forms here is a quick way to do it:

Using the Wicket Example: Ajax Builtin: FormPage as a base, the onError method is called if any of your validators fail, in there you need to view the children components attached to your form and check the isValid() method on each one.  A really easy to do this is the following:

    protected void onError(final AjaxRequestTarget target, Form form) {
   
    log.warn("onError Called");

                        // Safe way to view the children components...
    form.visitFormComponents(new FormComponent.IVisitor() {
   
    public void formComponent(FormComponent formComponent) {
                        log.debug("Checking: "  + formComponent.getMarkupId() + " " + formComponent.isValid());
   
    if (!formComponent.isValid())
Unknown macro: {
 target.addComponent(formComponent); 
target.appendJavascript("new Effect.Shake($(" + formComponent.getMarkupId() + "));"); } 
   
    }
    });
    }
The above example also adds in _javascript_ effects borrowed from the Effects example using the script.aculo.us library.











Powered by
Atlassian Confluence
(Version: 2.2.9 Build:#527 Sep 07, 2006)
-
Bug/feature request

Unsubscribe or edit your notifications preferences