webtier@glassfish.java.net

Re: [webtier] Validators of h:inputText not getting invoked value is ""

From: Lincoln Baxter, III <lincolnbaxter_at_gmail.com>
Date: Mon, 16 Feb 2009 18:41:35 -0500

JSF doesn't invoke validators on blank fields.

You'll need to set the required="true" attribute in order to enforce
this. It's weird, I know.

You may also be interested in this little tutorial:
http://forums.sun.com/thread.jspa?threadID=523119&messageID=2505792&forumID=427

Best of luck.

--Lincoln

On Mon, 2009-02-16 at 12:04 -0800, webtier_at_javadesktop.org wrote:

> Hi,
>
> I am using jsf api and impl 1.2._12.
>
> I have the following facelet mark up:
>
> <h:inputText id="testInput" value="#{testController.test}" required="false">
> <f:validator validatorId="stateValidator"/>
> </h:inputText>
>
> The "stateValidator" is configured as follows in faces-config
>
> <validator>
> <validator-id>stateValidator</validator-id>
> <validator-class>adc.validators.MultiFieldLengthValidator</validator-class>
> </validator>
>
> The validator is getting invoked with no issues when the value of the field is anything other than "". But when the value is "", the validator does not get invoked.
>
> I am wondering if I am doing something wrong. Please advise on potential solutions.
>
> TIA,
> Babu
> [Message sent by forum member 'babus_18' (babus_18)]
>
> http://forums.java.net/jive/thread.jspa?messageID=332110
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: webtier-help_at_glassfish.dev.java.net
>