Js档案:
$(document).on('change', '#DoctorsCreateForm\\:crm', function () {
hideUfCrm(this, $('#DoctorsCreateForm\\:ufCrm'));
});
function hideUfCrm(crm, uf) {
uf.disabled = crm.value === '' ? true : false;
}
XTHML页面:
<p:inputText id="crm" value="#{doctorsController.selected.crm}" title="#{bundle.CreateDoctorsTitle_crm}" required="true" requiredMessage="#{bundle.CreateDoctorsRequiredMessage_crm}" maxlength="7" >
<f:attribute name="uf" value="#{uf}" />
<f:validator validatorId="crmValidator" />
</p:inputText>
<p:outputLabel value="#{bundle.CreateDoctorsLabel_ufCrm}" for="ufCrm" />
<p:selectOneMenu id="ufCrm" disabled="true"
value="#{doctorsController.selected.ufCrm}" required="true" requiredMessage="#{bundle.CreateDoctorsRequiredMessage_type}" binding="#{uf}" >
<f:selectItem itemLabel="Select One" itemValue="#{null}" noSelectionOption="true" />
<f:selectItems value="#{doctorsController.states}" var="state" itemLabel="#{state}"
itemValue="#{state}" />
</p:selectOneMenu>
我正在尝试禁用selectOneMenu,只有在(#crm)inputText上没有文字时,我做错了什么?