I have a registration form with an optional field but if you enter any value it should be more than 2 characters. How to skip validation if the user leaves the field blank?
<h:inputText id ="fooid" maxlength="50" tabindex="4" value="#{registrationBean.foo}" validatorMessage="Please enter two or more characters">
<f:validateRegex pattern="^[A-Za-z-_./\s]{2,50}$"/>
<f:ajax event="blur" render="fooPanel" />
</h:inputText>
Any help would be appreciated.