I need to use p:selectonemenu and make it disabled, i.e. it should be submitted during a post but it should be read-only. Please note that I do NOT want to use the disabled attribute as this will prevent posting.
I have read on this forum that this can be achieved by using a hidden field, however I do not understand how this can be implemented. I would appreciate if someone out there could provide me with some help in this regard.
<p:inputText id="cpr" value="#{customerbean.customer.cpr}">
<p:ajax event="change" listener="#{customerbean.fetchCustomerDatafromCBS}" update="nationality address passportno name nationality dob address mailingaddress gender mobileno landlineno otherno email maritalstatus nochildren" immediate="true" >
<f:param name="cprNumber" value="#{customerbean.customer.cpr}"/>
</p:ajax>
<f:validator validatorId="cprValidator" />
</p:inputText>
<p:selectOneMenu id="gender" value="#{customerbean.customer.gender}" required="!#{customerbean.disabled}" requiredMessage="#{text['validation.error.required.gender']}" disabled="#{customerbean.disabled}">
<f:selectItem itemLabel="Select One" itemValue="" noSelectionOption="true" />
<f:selectItem itemLabel="Male" itemValue="Male" />
<f:selectItem itemLabel="Female" itemValue="Female" />
</p:selectOneMenu>
<p:inputText type="hidden" value="#{customerbean.customer.gender}" />