英文:
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.
在xp:comboBox中,我似乎无法触发onChange事件。djComboBox可以正常工作,但这里不涉及与其相关的其他问题。
There is no issue with events such as onBlur
对于像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>
英文:
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>
答案1
得分: 0
你应该检查数据源而不是组件(使用 getComponent)。所以例如尝试:viewScope.xpcombo == "Cease"
英文:
You should check the data source instead of the component (using getComponent). So try for example: viewScope.xpcombo == "Cease"
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论