xpages

ComboBox onChange event does not fire


I cannot seem to get the onChange event to fire in the xp:comboBox. The djComboBox works fine, but I have other issues with that which are not relevant here.

There is no issue with events such as onBlur

These two snippets show the problem, I am probably missing something obvious, but any help is appreciated.

<xp:comboBox id="comboBox1" style="width:130.0px"
    value="#{viewScope.xpcombo}" disableClientSideValidation="true" immediate="true">
    <xp:selectItem itemLabel="" id="selectItem3"></xp:selectItem>
    <xp:selectItem itemLabel="Cease" itemValue="Cease"
        id="selectItem1">
    </xp:selectItem>
    <xp:eventHandler event="onChange" submit="true"
        refreshMode="full" id="eventHandler1" disableValidators="true">
    </xp:eventHandler>
</xp:comboBox>
                <xp:text id="computedField1">
                    <xp:this.value><![CDATA[#{javascript:var req = getComponent("comboBox1").getValue();
 if( req == "Cease") {return "Some cease text frome combBox1";}
}]]></xp:this.value>
                </xp:text>
                
                

<xe:djComboBox id="djComboBox" style="width:130.0px"
                    value="#{viewScope.djcombo}" immediate="true">

                    <xp:selectItem itemLabel="" id="selectItem5">
                    </xp:selectItem>
                    <xp:selectItem itemLabel="Cease"
                        itemValue="Cease" id="selectItem6">
                    </xp:selectItem>
                    
                    <xp:eventHandler event="onChange" submit="true" refreshMode="full" 
                        id="eventHandler2"  disableValidators="true">
                    </xp:eventHandler>
                    </xe:djComboBox>
        
                
                <xp:text id="computedField2">
                    <xp:this.value><![CDATA[#{javascript:var req = getComponent("djComboBox").getValue();
if( req == "Cease") {
return "Some cease text frome djCombBox";}
}]]></xp:this.value>
                </xp:text>

Solution

  • You should check the data source instead of the component (using getComponent). So try for example: viewScope.xpcombo == "Cease"