私の実際のアプリケーションでは、繰り返しコントロール内に他のコントロールがまだあるため、チェックボックスグループを使用していません。以下は私のサンプルソースです:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:repeat id="repeat1" rows="30" var="curRow" indexVar="rowIndex"><xp:this.value><![CDATA[#{javascript:['option 1', 'option 2', 'option 3']}]]></xp:this.value>
<xp:table>
<xp:tr>
<xp:td>
<xp:checkBox text="#{javascript:curRow}"
id="checkBox1">
<xp:eventHandler event="onchange" submit="true"
refreshMode="complete">
</xp:eventHandler></xp:checkBox>
</xp:td>
</xp:tr>
</xp:table></xp:repeat>
<xp:button id="button1" value="Submit" disabled="#{javascript:!getComponent('checkBox1').isChecked()}"></xp:button>
</xp:view>
これが CSJS で実現できればさらによいでしょう。
編集
@swissel
デフォルトでボタンを無効にし、クライアント側のチェックボックスの onchange イベントに次のコードを追加しました。
var a=dojo.query('input:checked', 'view:_id1').length;
if(a!=3){
alert('Not yet!');
document.getElementById("#{id:button1}").removeAttribute("disabled");
}else{
alert('Done! All checkboxes are checked!');
document.getElementById("#{id:button1}").setAttribute("disabled", true);
}
これらのアラートは、使用すると正常に機能しているようです。ただし、ボタンは無効のままです。XPage の 3 つの Dojo オプションをすべて有効にしました。ボタンを部分的に更新するように onchange を設定しても、何も起こりませんでした。私が逃したものはありますか?