Oct 12, 2015, 11:31 AM
25 Posts

Combo box partial refresh issue

  • Category: Other
  • Platform: All
  • Release: 8.5.3
  • Role: Developer
  • Tags: combo box,partial refresh
  • Replies: 1

As shown in the image below, I have two combo boxes, the second is dependent on the values selected from the first.

<xp:tr themeId="HtmlTr.form.body">
            <xp:td themeId="HtmlTd.form.body.label">
                <xp:label value="Reader group:"
                    id="labelReaderGroup" for="readerGroups1"
                    themeId="Text.table.label">
                </xp:label>
            </xp:td>
            <xp:td themeId="HtmlTd.form.body">
                <xp:comboBox value="#{dominoDoc.ReaderGroups}"
                    id="readerGroups1" disableClientSideValidation="true">
                    <xp:this.validators>
                        <xp:validateRequired
                            message="Reader Group is required.">
                        </xp:validateRequired>
                    </xp:this.validators>
                    <xp:selectItems>
                        <xp:this.value><![CDATA[#{javascript:@Text("")}]]></xp:this.value>
                    </xp:selectItems>
                    <xp:selectItems>
                        <xp:this.value><![CDATA[#{javascript:@DbColumn("", "RolesforDB", 1);}]]></xp:this.value>
                    </xp:selectItems>
                    <xp:eventHandler event="onchange" submit="true"
                        refreshMode="partial">
                    </xp:eventHandler></xp:comboBox>
                <xp:message id="messageReaderGroups" for="readerGroups1"></xp:message></xp:td>
        </xp:tr>
        <xp:tr>
            <xp:td themeId="HtmlTd.form.body">
                <xp:label value="Categories:" id="categories_Label1"
                    for="categories1" themeId="Text.table.label">
                </xp:label>
            </xp:td>
            <xp:td themeId="HtmlTd.form.body">
                <xp:comboBox value="#{dominoDoc.Categories}"
                    id="categories1">
                    <xp:selectItems>
                        <xp:this.value><![CDATA[#{javascript:@Text("")}]]></xp:this.value>
                    </xp:selectItems>
                    <xp:selectItems>
                        <xp:this.value><![CDATA[#{javascript:var key = String(getComponent("readerGroups1").getValue());
if(key.trim().equals(""))
{
    return "";
}
@DbLookup(@DbName(),"CategoriesByRole",key,2);
}]]></xp:this.value>
                    </xp:selectItems>
                    <xp:eventHandler event="onchange" submit="true"
                        refreshMode="partial">
                    </xp:eventHandler></xp:comboBox>
            </xp:td></xp:tr><xp:tr themeId="HtmlTr.form.body">
            <xp:td themeId="HtmlTd.form.body.label">
                
            </xp:td>
            <xp:td themeId="HtmlTd.form.body">

            </xp:td>
</xp:tr>

What am I doing wrong.

 

By the way, I was able to make it so the reader group is required.

on the refresh, I would think that it would know that readerGroups1 == "" and then the bit in my code about if key.trim().equals("") would make the values for the categories field then be "".. but it isn't working as I thought.

 

Any help would be greatly appreciated.

combobox refresh issue

Oct 12, 2015, 12:50 PM
25 Posts
Lots of help (thanks)

Discovered that I needed to set the Process data with out validation option on the onchange event.

 

Thank you David Leedy, Howard Greenburg and Chris Toohey for your patience.