webtier@glassfish.java.net

Re: [webtier] JSF2 Validation Behavior?

From: Lincoln Baxter, III <lincolnbaxter_at_gmail.com>
Date: Mon, 31 Aug 2009 23:53:54 -0400

Nope, neither beans validation API nor javax.faces.VALIDATE_EMPTY_FIELDS
are present in my application, yet my validators are being called
(checked via step debugging.) I'll file an issue for this:

https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=623

I'm using 2.0.0-b16

<h:inputSecret id="oldpassword" required="false">
    <f:validator validatorId="currentUserPasswordValidator" />
</h:inputSecret>

<h:inputSecret id="password" required="false"
    value="#{userProfileBean.newPassword}">
    <f:validator validatorId="passwordValidator" />
</h:inputSecret>

<h:inputSecret id="passwordConfirm" required="false">
    <f:validator validatorId="passwordValidator" />
</h:inputSecret>




On Mon, 2009-08-31 at 08:31 -0700, Ryan Lubke wrote:

> On 8/30/09 11:11 AM, Lincoln Baxter, III wrote:
>
> > If I am remembering correctly, validators do not fire for empty
> > fields on form submission. I'm currently seeing behavior in the
> > latest snapshot where validators are indeed firing on empty fields.
> >
> > Is this intended? I seem to recall discussion about this some time
> > ago, but can't find it.
> >
> > Is there a behavior toggle switch? What am I missing?
>
> There's a context init parameter called
> 'javax.faces.VALIDATE_EMPTY_FIELDS'.
> The value will default to false *unless* the Beans Validation API is
> present in which case the value will be set to true (if not
> already explicitly set).
>
> See UIInput#valdiateValue(FacesContext,Object) for details.
>
> >
> > --Thanks,
> > Lincoln
>
>