In Client side javascript, it is a powerful script language for manipulating our DOM object.
I have a check box group in Xpages. And I added a hashMap value into that check box group.
Ex:
key value
1 X
2 Y
3 Z
But I am not able to get the key's label name [1,2, 3]. I can get the X,Y,Z as values.
The following is the check Box group value in Xpage.,
<xp:checkBoxGroup id="checkBoxGroup1">
<xp:selectItem itemLabel="1" itemValue="X"></xp:selectItem>
<xp:selectItem itemLabel="2" itemValue="Y"></xp:selectItem>
<xp:selectItem itemLabel="3" itemValue="Z"></xp:selectItem>
</xp:checkBoxGroup>
But in backend HTML code is as follows...
<fieldset id="view:_id1:checkBoxGroup1" class="xspCheckBox"><table class="xspCheckBox">
<tr>
<td>
<label><input name="view:_id1:checkBoxGroup1" value="X" type="checkbox"> 1</input></label></td>
<td>
<label><input name="view:_id1:checkBoxGroup1" value="Y" type="checkbox"> 2</input></label></td>
<td>
<label><input name="view:_id1:checkBoxGroup1" value="Z" type="checkbox"> 3</input></label></td>
</tr>
</table></fieldset>
So I am not to get this via its children...
So i used parentNode for finding its label name.,
Try the following is used to get the values of checkBoxGroup's Key value...
var check= document.forms[0].elements["#{id:Column}"]
var label=null;
var value1=null;
alert("Test");
for(var i=0;i {
if(document.forms[0].elements["#{id:Column}"][i].checked)
{
label=label+","+((document.forms[0].elements["#{id:Column}"][i].parentNode.textContent))
value1=value1+","+(document.forms[0].elements["#{id:Column}"][i].value)
}
}
alert(label + "-- " +value1)
I have a check box group in Xpages. And I added a hashMap value into that check box group.
Ex:
key value
1 X
2 Y
3 Z
But I am not able to get the key's label name [1,2, 3]. I can get the X,Y,Z as values.
The following is the check Box group value in Xpage.,
<xp:checkBoxGroup id="checkBoxGroup1">
<xp:selectItem itemLabel="1" itemValue="X"></xp:selectItem>
<xp:selectItem itemLabel="2" itemValue="Y"></xp:selectItem>
<xp:selectItem itemLabel="3" itemValue="Z"></xp:selectItem>
</xp:checkBoxGroup>
But in backend HTML code is as follows...
<fieldset id="view:_id1:checkBoxGroup1" class="xspCheckBox"><table class="xspCheckBox">
<tr>
<td>
<label><input name="view:_id1:checkBoxGroup1" value="X" type="checkbox"> 1</input></label></td>
<td>
<label><input name="view:_id1:checkBoxGroup1" value="Y" type="checkbox"> 2</input></label></td>
<td>
<label><input name="view:_id1:checkBoxGroup1" value="Z" type="checkbox"> 3</input></label></td>
</tr>
</table></fieldset>
So I am not to get this via its children...
So i used parentNode for finding its label name.,
Try the following is used to get the values of checkBoxGroup's Key value...
var check= document.forms[0].elements["#{id:Column}"]
var label=null;
var value1=null;
alert("Test");
for(var i=0;i
if(document.forms[0].elements["#{id:Column}"][i].checked)
{
label=label+","+((document.forms[0].elements["#{id:Column}"][i].parentNode.textContent))
value1=value1+","+(document.forms[0].elements["#{id:Column}"][i].value)
}
}
alert(label + "-- " +value1)
In server side,
ReplyDeletereturn getComponent("checkBoxGroup1").getChildren().get(0).getAttributes().get("itemLabel")
It is very useful but it is only for Manual value., It will not work with computed value.