【前提】
JSF2.2(+PrimeFaces)で画面を作っています。
【やりたい事】
チェックボックスにチェックを付けた時、ボタンの活性・非活性を制御したいです。
スポーツ種類のチェックボックスがあり、その中の、「その他」にチェックを付けたら、
「送信する」ボタンが非活性になるように制御したいです。
【現状のxhtml】
<tr> <td>スポーツ種類</td> <td><p:selectManyCheckbox id="sport"> <f:selectItem itemLabel="野球" itemValue="sel1"/> <f:selectItem itemLabel="サッカー" itemValue="sel2"/> <f:selectItem itemLabel="テニス" itemValue="sel3"/> <f:selectItem itemLabel="その他" itemValue="sel4"/> </p:selectManyCheckbox> </td> <td> <p:commandButton action="#{testBean.send}" value="送信する" /> </td>【思っている事】
<p:commandButton action="#{testBean.send}" value="送信する" />
に、
<p:commandButton action="#{testBean.send}" value="送信する" disabled="true"/>
のように、「disabled」属性を付ければボタンの活性・非活性が切り替わるのはわかりますが、
それを、チェックボックスによって動的に変更させるには、どうしたらよいでしょうか。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。