I checked a little example and it worked as expected:
- nothing in field <ENTER> results in "All valid!"
- wrong email in field <ENTER> results in "oops"
- valid email in field <ENTER> results in "All valid!"

public class HomePage extends WebPage {

    public HomePage(final PageParameters parameters) {
        Form<Void> form = new Form<Void>("form") {
            @Override
            protected void onSubmit() {
                System.out.println("All valid!");
            }

            @Override
            protected void onError() {
                System.out.println("oops");
            }
        };
TextField<String> email = new TextField<String>("email", new Model<String>());
        email.add(EmailAddressValidator.getInstance());
        email.setRequired(false);
        form.add(email);
        add(form);
    }
}

html
<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd";>
<head><title>Title</title></head>
<body><form wicket:id="form"><input type="text" wicket:id="email" /></form></body>
</html>
Right, but for this validator you are forced to use the singleton,
which doesn't allow you to customize this feature.

On Fri, Feb 18, 2011 at 9:53 AM, Mike Mander<wicket-m...@gmx.de>  wrote:
Am 18.02.2011 15:39, schrieb hrbaer:
Any idea?
Did you check INullAcceptingValidator<T>  and
AbstractValidator<T>.validateOnNullValue() ?
They discribe what is to do.

Cheers
Mike

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


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




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

Reply via email to