Question

I can set the "value" using the script below.

<xe:djextListTextBox id="inputText" value="#{document1.FormTitle}" displayLabel="true" multipleSeparator="##"></xe:djextListTextBox>

<xp:button value="Set Value" id="b1">
    <xp:eventHandler event="onclick" submit="false">
        <xp:this.script><![CDATA[var id = "#{id:inputText}";
        dijit.byId( id ).set( "value", "Value 1##Value 2" );        
        ]]></xp:this.script>
    </xp:eventHandler>
</xp:button>

But what I would like to do is set a label to display and have another value in the background. Essentially duplicating the functionality displayed below.

<xe:djextListTextBox id="djextListTextBox14" multipleSeparator="," multipleTrim="true" defaultValue="1,3" value="#{document1.Test}"
    displayLabel="true" title="Multiple Values with labels">
</xe:djextListTextBox>
<xe:valuePicker id="valuePicker15" for="djextListTextBox14" pickerText="Add" dojoType="extlib.dijit.PickerListSearch">
    <xe:this.dataProvider>
        <xe:simpleValuePicker labelSeparator="|" valueList="Value1|1,Value2|2,Value3|3,Value4|4" valueListSeparator=","></xe:simpleValuePicker>
    </xe:this.dataProvider>
</xe:valuePicker>
Was it helpful?

Solution

You can define labels for xe:djextListTextBox on client side with

dijit.byId(id).set("labels", {"value1":"label1","value2":"label2",...});

Your example would look like this then:

<xe:djextListTextBox id="inputText" value="#{document1.FormTitle}" 
      displayLabel="true" multipleSeparator="##">
</xe:djextListTextBox>
<xp:button value="Set Value" id="b1">
    <xp:eventHandler event="onclick" submit="false">
        <xp:this.script><![CDATA[
            var id = "#{id:inputText}";
            dijit.byId(id).set("labels", {"Value 1":"Label 1", "Value 2":"Label 2"});
            dijit.byId(id).set("value", "Value 1##Value 2");        
        ]]></xp:this.script>
    </xp:eventHandler>
</xp:button>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top