简体   繁体   English

使用JSF Primefaces中的一个单选框禁用两个控件

[英]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. 上面的代码的问题是我不能为另一个控件使用相同的ID。 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. 在上述情况下,当单击UPLOAD CLR时,我想禁用此输入框。

Please suggest 请建议

You can define multiple components to update in update attribute. 您可以在update属性中定义多个要更新的组件。 Just add another id like: 只需添加另一个ID,例如:

update="id1 id2"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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