In my XPage I have xp:comboBox
with dojoType
set to dojox.form.CheckedMultiSelect
. When I try to get its value in SSJS using getComponent("comboBox1").getValue()
it returns null
. If I remove the dojoType
then the code works.
Here's the complete code:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:this.resources>
<xp:dojoModule name="dojox.form.CheckedMultiSelect"></xp:dojoModule>
<xp:styleSheet href="/.ibmxspres/dojoroot/dojox/form/resources/CheckedMultiSelect.css"></xp:styleSheet>
</xp:this.resources>
<xp:comboBox id="comboBox1" dojoType="dojox.form.CheckedMultiSelect">
<xp:selectItem itemLabel="Untitled 1"></xp:selectItem>
<xp:selectItem itemLabel="Untitled 2"></xp:selectItem>
<xp:selectItem itemLabel="Untitled 3"></xp:selectItem>
</xp:comboBox>
<xp:comboBox id="comboBox2">
<xp:selectItem itemLabel="Untitled 1"></xp:selectItem>
<xp:selectItem itemLabel="Untitled 2"></xp:selectItem>
<xp:selectItem itemLabel="Untitled 3"></xp:selectItem>
</xp:comboBox>
<xp:button value="Label" id="button1">
<xp:eventHandler event="onclick" submit="true" refreshMode="complete">
<xp:this.action><![CDATA[#{javascript:print("============ " + getComponent("comboBox1").getValue());
print("============ " + getComponent("comboBox2").getValue());}]]></xp:this.action>
</xp:eventHandler>
</xp:button>
</xp:view>
I the above code comboBox1
has dojoType
set to dojox.form.CheckedMultiSelect
while comboBox2
is plain combo box. On click of button value of comboBox2
is printed on console while for comboBox1
it prints null.
Why does this happen? What can I do to get the value from comboBox1
?