【发布时间】:2015-05-04 05:28:54
【问题描述】:
我在 Google 上搜索过很多次,但我似乎找不到答案。
What needs to be done is that the outputLabel's value needs to be updated when the selection change, also inputText's disabled needs to change to enabled when you select option B. (Furthermore; the selected value is displayed in the inputText)
我的 xhtml 被剪断了:
<p:selectOneMenu id="findex" value="#{myController.selected.findex}" >
<p:ajax update="extra1 labelextra1" immediate="true"/>
<f:selectItem itemLabel="Value A" itemValue="A" />
<f:selectItem itemLabel="Value B" itemValue="B" />
</p:selectOneMenu>
<p:outputLabel id="labelextra1" value="#{myController.selected.findex == 'A' ? '' : 'X'}" for="extra1"/>
<p:inputText id="extra1" value="#{myController.selected.findex}" disabled="#{myController.selected.findex == 'A'}"/>
(如果我将支持 bean 中的侦听器添加到 ajax 中,它确实会被调用,但我不确定我是否需要它,这是一个简单的更改事件,不是吗?)
【问题讨论】:
-
没有
immediate="true"也能用吗? -
不,无论是否有 immediate="true" 都没有变化
标签: jsf-2 primefaces selectonemenu