I need to change the value of the input LevelNo to 0 and the input factoryCode is disabled, otherwise nothing should happen. I have the following code:
<p:inputMask id="LevelNo" size="4" maxlength="9" mask="9?99999999" slotChar="" style="text-align: right;" value="#{MeuManageBean.requestDTO.levelNo}" rendered="#{MeuManageBean.mode eq 'MODE_NEW_REGISTER' or MeuManageBean.mode eq 'MODE_COPY_NEW' or MeuManageBean.mode eq 'MODE_EDIT'}">
<f:validateLongRange minimum="0" />
<f:convertNumber integerOnly="true"/>
<p:ajax event="change" process=" @this" update="@form" listener="#{MeuManageBean.enableOrDisableFieldsByLevelNo}" />
</p:inputMask>
<p:inputText id="factoryCode" size="4" value="#{MeuManageBean.requestDTO.factoryCode}" rendered="#{MeuManageBean.mode eq 'MODE_NEW_REGISTER' or MeuManageBean.mode eq 'MODE_COPY_NEW' or (MeuManageBean.mode eq 'MODE_EDIT' and MeuManageBean.disabledFieldsLevelZero == false) }" readonly="#{MeuManageBean.disabledFieldsLevelZero}" required="true">
<f:converter converterId="com.projeto.converter.UpperCaseConverter" />
</p:inputText>
As it stands, when I change the value of the factoryCode field and then change the value of LevelNo, jsf deletes the value of the factoryCode field, because in the component tree the value is still "", if it is for disable the system has the expected behavior, otherwise the behavior expected by the user is that the value is maintained.
If I put the factoryCode in the ajax process, the system presents the validation error because the field is required, I can not put the immediate="true" because I need the component to be updated with "", if already has been populated and I have other behaviors that I need to keep even in ajax, as this is just part of my code.
Does anyone have any idea how to get the behavior I expect using primaxes ajax