So the list of objects is in this case multiple input fields?
Why do that in a list, just give every email field that validator and
let wicket be the one that iterates of the list. Then you also have
much better feedback to the end user
On 7/5/08, atul singh <[EMAIL PROTECTED]> wrote:
> Can someone please suggest a way to use/extend the current validators to
> validate list of objects.
> The problem is i have to write code in the following manner and don't know
> if it is a good approach.
>
> EmailAddressValidator validator = EmailAddressValidator.getInstance();
> for (final Iterator it =
> invitationForm.getEmailList().iterator(); it.hasNext();)
> {
> validator.validate(new IValidatable()
> {
>
> public void error(IValidationError error)
> {
> form.error("One or More of email ids are not in
> valid format");
> }
>
> public Object getValue()
> {
> return (String)it.next();
> }
>
> public boolean isValid()
> {
> return form.hasError();
> }
>
> });
>
> if (form.hasError())
> {
> break;
> }
> }
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]