Here is a working example for core control xp:comboBox
where users can enter values not in list without using Extension Library:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view
xmlns:xp="http://www.ibm.com/xsp/core">
<xp:this.resources>
<xp:dojoModule
name="dijit.form.ComboBox"
rendered="true">
</xp:dojoModule>
</xp:this.resources>
<xp:comboBox
id="comboBox1"
value="#{sessionScope.Test}"
dojoType="dijit.form.ComboBox"
disableValidators="true">
<xp:selectItem itemLabel="abc"></xp:selectItem>
<xp:selectItem itemLabel="def"></xp:selectItem>
<xp:selectItem itemLabel="xyz"></xp:selectItem>
</xp:comboBox>
<xp:button
value="Submit"
id="button1">
<xp:eventHandler
event="onclick"
submit="true"
refreshMode="complete"
immediate="false"
save="true">
</xp:eventHandler>
</xp:button>
</xp:view>
Three things are important here:
- Add dojoModule ressource
dijit.form.ComboBox
- Add
dojoType="dijit.form.ComboBox"
- Add
disableValidators="true"
otherwise new values not in list won't get submitted.
If you are allowed to use Extension Library in your project then you would use Dojo Form control "Dojo Combo Box" xe:djComboBox
of course instead.