xpages combobox control where user can enter values not in list

怎甘沉沦 提交于 2019-12-12 04:43:38

问题


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


回答1:


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:

  1. Add dojoModule ressource dijit.form.ComboBox
  2. Add dojoType="dijit.form.ComboBox"
  3. 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.




回答2:


Got it with a djComboBox wish it were property of the core control.



来源:https://stackoverflow.com/questions/20276137/xpages-combobox-control-where-user-can-enter-values-not-in-list

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!