Skip validation conditionally JSF

后端 未结 1 1956
我在风中等你
我在风中等你 2021-01-06 17:31

Requirement is to skip field validation conditionally. When user selects add, the form fields should be validated and values added to the table. If edit is clicked, form fie

相关标签:
1条回答
  • 2021-01-06 17:54

    Your code is incomplete as you're nowhere showing how disableBeanValidation is implemented and how you're passing the #{param[skipBeanValidation]} around.

    But it should basically boil down to:

    <f:validateBean disabled="#{param.skipBeanValidation}" />
    
    ...
    
    <h:commandLink value="Edit" action="#{buyerBacking.edit}"/>
        <f:param name="skipBeanValidation" value="true" />
    </h:commandLink>
    

    Please note that #{param.skipBeanValidation} is quite different from #{param[skipBeanValidation]} (but the same as #{param['skipBeanValidation']}). Also please note that the desired request parameter to skip the bean validation is been passed as a HTTP request parameter, exactly as is been expected by #{param}.

    0 讨论(0)
提交回复
热议问题