使用 SSJS 的“保存”按钮不会在 Web xpage 中打开 xe:dialog,但适用于移动 xpage

2023-12-05

以下保存按钮代码在移动 xpage 上运行良好:

var checkBox31:com.ibm.xsp.component.xp.XspInputCheckbox = getComponent("checkBox31");
var customerID1:com.ibm.xsp.component.xp.XspInputText = getComponent("customerID1");
var a = checkBox31.getValue();
var b = customerID1.getValue()
if (a == "" || a == null){
   if (b == ""){
   sessionScope.put("ITDialog","You must enter Customer ID");
   var dialog1:com.ibm.xsp.extlib.component.dialog.UIDialog = getComponent("dialog1");
    dialog1.show();
   }
   }

但它在 web xpage 上不起作用。我正在使用8.5.3FP6。我使用 8.5.3FP1 和 8.5.3FP5 但遇到了同样的问题。

预先感谢您的任何帮助。

这是不起作用的代码示例。

]]></xp:this.script>
                                </xp:executeClientScript>
                            </xp:this.script>
                        </xp:eventHandler>
                    </xp:button>
                    &#160;
                </xp:panel>
            </xe:dialog>
        </xp:panel>
        <xp:table>
            <xp:tr>
                <xp:td style="background-color:rgb(226,226,226)">
                    <xp:label
                        value="Company:"
                        id="company_Label1"
                        for="company1">
                    </xp:label>
                </xp:td>
                <xp:td>
                    <xp:inputText
                        value="#{document1.Company}"
                        id="company1">
                    </xp:inputText>
                </xp:td>
            </xp:tr>
            <xp:tr>
                <xp:td style="background-color:rgb(226,226,226)">
                    <xp:label
                        value="Address:"
                        id="address_Label1"
                        for="address1">
                    </xp:label>
                </xp:td>
                <xp:td>
                    <xp:inputText
                        value="#{document1.Address}"
                        id="address1">
                    </xp:inputText>
                </xp:td>
            </xp:tr>
            <xp:tr>
                <xp:td style="background-color:rgb(226,226,226)">
                    <xp:label
                        value="Contact person:"
                        id="contactPerson_Label1"
                        for="contactPerson1">
                    </xp:label>
                </xp:td>
                <xp:td>
                    <xp:inputText
                        value="#{document1.ContactPerson}"
                        id="contactPerson1">
                    </xp:inputText>
                </xp:td>
            </xp:tr>
        </xp:table>
    </xp:panel>
</xp:view>

复选框的值为“false”或“true”(表示它是“取消选择”和“选择”),它不应返回值“”或 null。因此,第一个 if 语句永远不会为 true,并且您的对话框永远不会出现。

我相信您想要的是,如果取消选中该复选框,则输入中必须输入客户 ID。如果是这样,我认为这就是您想要的代码:

var checkBox31:com.ibm.xsp.component.xp.XspInputCheckbox = getComponent("checkBox31");
var customerID1:com.ibm.xsp.component.xp.XspInputText = getComponent("customerID1");
var a = checkBox31.getValue();
var b = customerID1.getValue();
if (a == "false") {
    if (b == "") {
        sessionScope.put("ITDialog","You must enter Customer ID");
        var dialog1:com.ibm.xsp.extlib.component.dialog.UIDialog = getComponent("dialog1");
        dialog1.show();
    }
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用 SSJS 的“保存”按钮不会在 Web xpage 中打开 xe:dialog,但适用于移动 xpage 的相关文章

随机推荐