Reputation: 2087
I need to create a comboBox control that displays a list of values but allowas the user to enter a value not in the list. I saw where you can do this with dijit.form.comboBox but I understand that no longer works after 8.5 something. So that route is out. This should be pretty basic and I'm guessing that I'm just missing a property somewhere. Any pointers?
Thanks in advance
Upvotes: 0
Views: 1762
Reputation: 30970
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:
dijit.form.ComboBox
dojoType="dijit.form.ComboBox"
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.
Upvotes: 2
Reputation: 2087
Got it with a djComboBox wish it were property of the core control.
Upvotes: 0