Reputation: 77
I am using a checkbox group whose values are populated from the back end configuration . The checkbox group is for selection of Lab parameters . In the configuration , I kept status of some parameter's as disabled and some parameters are enabled (with the usage of status field ). checkbox group brings all the disabled and enabled lab parameters . By default , I want the auto selection of those Lab parameters that are set as enabled i.e enabled parameters are auto selected in checkbox group. Is there any way to have some checked ( auto selected) values in the checkbox group .
Upvotes: 0
Views: 100
Reputation: 1417
You can set the default value of the checkbox in the data properties:
<xp:checkBoxGroup id="checkBoxGroup1">
<xp:this.defaultValue><![CDATA[#{javascript:new Array("TestValue1","TestValue2")}]]></xp:this.defaultValue>
<xp:selectItem
itemLabel="Test Label1"
itemValue="TestValue1">
</xp:selectItem>
<xp:selectItem
itemLabel="Test Label2"
itemValue="TestValue2">
</xp:selectItem>
<xp:selectItem
itemLabel="Test Label3"
itemValue="TestValue3">
</xp:selectItem>
</xp:checkBoxGroup>
I have used an array, but you can use any function that returns an array to do this.
Upvotes: 1