A has many required inputs and validations. A couple of command buttons control different inputs.
I can change required attibrute with the value of <f:param>
. For instance when a button is clicked,it sets a value.This value changes if an input is required or not. Like this:
<p:commandButton>
<f:param name="button1" value="1"></f:param>
</p:commandButton>
<h:inputText required="#{param['button1'] == 1}"></h:inputText>
This actually works.However i also want to add some valitations like max length.I want to temporarily change this validation too.
I tried to disable valitadion,but i did not work:
<f:validateLength disabled="true" maximum="10"></f:validateLength>
You seem to be using JSF 2.x already. So just use
<f:ajax execute>
or<p:commandButton process>
to specify client IDs of components which are to be executed/processed when the button is pressed. All components which are not included in this will just be ignored and not converted/validated.E.g.
In case of
<p:commandButton>
it defaults to@form
(i.e. the entire current form).See also: