webtier@glassfish.java.net

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

From: Ryan Lubke <Ryan.Lubke_at_Sun.COM>
Date: Tue, 17 Feb 2009 08:28:48 -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.
>
In JSF 1.2, validators will not be invoked if the value is null or a
zero-length string.
JSF 2.0 (still under development) loosens this restriction.

You could work around the issue by providing your own UIInput custom
component
that overrides UIInput.validateValue() with the behavior you desire.
Refer to the Facelets
documentation on wiring in a new component.

> 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
>
>