I used the ShinyFormVisitor principle as described in the pdf: and I get
following errors(in bold):

public class ShinyFormVisitor implements IVisitor, Serializable {

    Set visited = new HashSet();

    public Object component(Component c) {
        if (!visited.contains(c)) {
            visited.add(c);
            c.setComponentBorder(new RequiredBorder());
            c.add(new ValidationMsgBehavior());
            c.add(new ErrorHighlightBehavior());
        }
*//CONTINUE_TRAVERSAL could not be found*
        return *IVisitor.CONTINUE_TRAVERSAL*;
    }

    private class RequiredBorder extends BorderBehavior {

        public void renderAfter(Component component) {
            FormComponent fc = (FormComponent) component;
            if (fc.isRequired()) {
                super.afterRender(component);
            }
        }
    }

*//AbstractBehaviour could not be found*
    private class ValidationMsgBehavior extends *AbstractBehavior* {

        public void onRendered(Component c) {
            FormComponent fc = (FormComponent) c;
            if (!fc.isValid()) {
                String error;
                if (fc.hasFeedbackMessage()) {
*//getFeedbackMessage() could not be found*
                    error =*
fc.getFeedbackMessage()*.getMessage().toString();
                } else {
                    error = "Your input is invalid.";
                }
                fc.getResponse().write(
                        "<div class=\"validationMsg\">" + error + "</div>");
            }
        }
    }

*//AbstractBehaviour could not be found*
    private class ErrorHighlightBehavior extends *AbstractBehavior* {

        public void onComponentTag(Component c, ComponentTag tag) {
            FormComponent fc = (FormComponent) c;
            if (!fc.isValid()) {
                tag.put("class", "error");
            }
        }
    }
}



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/highlight-invalid-fields-with-custom-Validation-Framework-tp4652949p4652978.html
Sent from the Users forum mailing list archive at Nabble.com.

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

Reply via email to