简体   繁体   中英

disable two controls using one radio box in JSF Primefaces

I have to disable two controls on the page using one pair of radio buttons I have the following code:

<p:selectOneRadio id="console" binding="#{yesOrNo}" required="true">}">
  <f:selectItem itemValue="Yes" itemLabel="UPLOAD CLR" />
                    <f:selectItem itemValue="No" itemLabel="ORDER NUMBER" />
<p:ajax update="yesdata" />
        </p:selectOneRadio>     
         <p:fileUpload  id="yesdata"  fileUploadListener="#cBean.handleFileUpload}"
                label="Upload NC CLR" mode="advanced" multiple="false"
                update="createConfigPanel" auto="true" sizeLimit="100000" allowTypes="/(\.|\/)(xls|xlsx)$/"  disabled="#yesOrNo.value != 'Yes'}" /> 

The problem with the above code is I cannot use the same ID for another control. Code continued:

    <h:panelGrid columns="2" cellpadding="8">
        <p:outputLabel for="serviceType" value="Service Type" />
                    <p:inputText id="serviceType"
                        value="#{cBean.serviceType}" required="true"></p:inputText>
...

I want to disable this input box when UPLOAD CLR is clicked in the above case.

Please suggest

You can define multiple components to update in update attribute. Just add another id like:

update="id1 id2"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM