Search code examples
jsfweblogic-10.xmyfacesjboss-eap-7

Myfaces 2.0.5 : Disable validation if no value entered in field


Currently we are moving application from Weblogic 11g to Jboss eap 7.

For JSF forms, custom validator is enabled in this application as below

<h:inputText id="lastName" maxlength="30" styleClass="InputBoxMedium" value="#{searchBean.lastName}" onkeyup="checkAllEmptyField('Search', 'searchActive', 'searchInactive', 5)">
                                        <f:validator validatorId = "searchValidator"/>
                                    </h:inputText>

Assume we have 10 similar fields, In Weblogic, this validator is only called for validation for non-empty fields In Jboss, validator is called for all fields.

we would like to have weblogic behavior in jboss.


Solution

  • Adding following in web.xml helped to resolve the problem in Jboss eap 7.....hope this will help someone in future....

    <context-param>
        <param-name>javax.faces.VALIDATE_EMPTY_FIELDS</param-name>
        <param-value>false</param-value>
    </context-param>
    

    Not sure why this was not required in weblogic :-(

    below link helped me, pls check it for details Shouldn't the validation be skipped when there is no value specified?