I need to use p: selectonemenu and disable it, i.e. it should be sent at the time of publication, but should be read-only. Please note that I do NOT want to use a disabled attribute, as this will prevent publication.
I read on this forum that this can be achieved using a hidden field, but I do not understand how this can be implemented. I would appreciate it if someone there could provide me 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}" />
source
share