顯示可選取或清除的方框。
<xp:checkBox attributes>content</xp:checkBox>
| 內容 | 說明 |
|---|---|
| id | 預設值為 checkBox1、checkBox2 等等。 |
| text | 提供標籤。 |
| value | 將控制項連結到資料元素或其他值。 |
| checkedValue | 指定當選取方框時的資料值。預設值為字串 true。 |
| uncheckedValue | 指定當清除方框時的資料值。預設值為字串 false。 |
| defaultChecked | 指定 true 可依預設選取方框。 |
<xp:checkBox id="checkBox2" text="Use user name instead of Anonymous"
defaultChecked="true" value="#{document1.loginname}" uncheckedValue="Anonymous"
checkedValue="#{javascript:session.getUserName()}">
</xp:checkBox>
<xp:checkBox text="Night phone same as day" id="checkBox1"
value="#{requestScope.phonesame}">
<xp:eventHandler event="onchange" submit="true" refreshMode="complete">
<xp:this.action><![CDATA[#{javascript:
if(requestScope.phonesame == "true") {
getComponent("phonenight").setValue(
getComponent("phoneday").getValue());
}
}]]></xp:this.action>
</xp:eventHandler>
</xp:checkBox>