XPages ApplicationLayout:获取 BannerLinks 中所选下拉项的点击值

XPages ApplicationLayout: get clicked value of selected drop down item in BannerLinks

我有一个下拉列表,我想使用 select 用户想要工作的省份(是的,我在加拿大!)。

我很难弄清楚如何获取单击的值,因为我想将该值放入会话范围变量中。

下拉菜单的代码目前是这样构建的:

 <xe:this.bannerUtilityLinks>
        <xe:basicContainerNode
            submitValue="provinceSwitch">
            <xe:this.children>
                <xe:basicLeafNode label="Québec"></xe:basicLeafNode>
                <xe:basicLeafNode label="Ontario"
                    submitValue="Ontario">
                </xe:basicLeafNode>

                <xe:basicLeafNode label="Maritimes"
                    submitValue="Maritimes">
                </xe:basicLeafNode>

                <xe:basicLeafNode label="West"
                    submitValue="West">
                </xe:basicLeafNode>

            </xe:this.children>
            <xe:this.label><![CDATA[#{javascript:if(!!sessionScope.province) {
    sessionScope.province;
    } else {
    "Province";
    }}]]></xe:this.label>
        </xe:basicContainerNode>

<xe:basicLeafNode submitValue="langSwitch"
                            styleClass="lotusFirst">
                            <xe:this.label>
                                <![CDATA[#{javascript:if(!!sessionScope.lang)  {
    if(sessionScope.lang=="FR") {
        return "English";
    } else {
        return "Français";
    }
} else {
    return "English";
}}]]>
                            </xe:this.label>

                        </xe:basicLeafNode>

    <xe:this.bannerUtilityLinks>

我已经定义了一个 eventHandler,用于 select 语言:

<xp:eventHandler event="onItemClick" submit="false"
                refreshMode="partial" refreshId="PanelAll">
                <xe:this.action><![CDATA[#{javascript:var submittedValue=context.getSubmittedValue();
if(submittedValue=="langSwitch") {
    if(!!sessionScope.lang)  {
        if(sessionScope.lang=="FR") {
            sessionScope.lang = "EN";       
        } else {
            sessionScope.lang = "FR";
        }
    } else {
        //since the default is FR, the first time it is clicked means we want to go to English
        sessionScope.lang = "EN";  
    }
    return; 
}}]]>
                </xe:this.action>
</xp:eventHandler>

如何从下拉列表中获取 selected 项目值并对其进行操作?我需要设置会话范围变量并进行完全(或部分)刷新。

谢谢:)

您必须向已有的 onItemClick 添加代码,因为该事件会执行应用布局的所有 onclick 事件。