Bryan Schmiedeler
Bryan Schmiedeler

Reputation: 3127

Xpages Getting Dojo Combo Box to have drop down

I am writing an Xpage in which the user can create a new document. On field is a category field. I want this field to be a drop down or type ahead with the possible values to be based upon previous entries. The user should also be able to add a new entry. So this is the equivalent to a traditional dialog list field with "formula for choices" and the formula comes form the first categorized field on a view, with the "Allow values not in list" checked. I am using a dojo Combo Box, but it displays the values in the field itself, instead of in a drop down. Not sure what I am doing wrong: My code is

<xe:djComboBox id="djComboBox2"
style="width:400px">
<xe:this.value><![CDATA[${javascript:var tmpView:String = "tipsByCategory";
var tmpColumn = 1;
var tmpVals = @DbColumn("",tmpView,tmpColumn);
tmpVals}]]></xe:this.value>

</xe:djComboBox>

Upvotes: 0

Views: 1293

Answers (1)

Knut Herrmann
Knut Herrmann

Reputation: 30960

In djComboBox

  • property value does the data binding to a document's field or a scope variable

  • property selectItems has to deliver the list of possible entries user can choose from.

Your code should look like this then:

<xe:djComboBox
    id="djComboBox2"
    style="width:400px"
    value="#{document1.yourField}">
    <xp:selectItems>
        <xe:this.value><![CDATA[${javascript:
        var tmpView:String = "tipsByCategory";
        var tmpColumn = 1;
        var tmpVals = @DbColumn("",tmpView,tmpColumn);
        tmpVals}]]></xe:this.value>
    </xp:selectItems>
</xe:djComboBox>

Upvotes: 1

Related Questions