使用 SSJS 的保存按钮不会在 web xpage 中打开 xe:dialog 但可以在移动 xpage 上打开 [英] Save button using SSJS does not open xe:dialog in web xpage but works on mobile xpage

查看:24
本文介绍了使用 SSJS 的保存按钮不会在 web xpage 中打开 xe:dialog 但可以在移动 xpage 上打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

The following save button code works well on mobile 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 但也有同样的问题.

But it does not work on web xpage. I'm using 8.5.3FP6. I used 8.5.3FP1 and 8.5.3FP5 bu had same issue.

在此先感谢您的帮助.

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

Here is sample of code which is not working.    

]]></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'(表示它是 'deselected' & 'selected'),它不应该返回"" 或 null 的值.因此,第一个 if 语句永远不会为真,并且您的对话框永远不会出现.

A checkbox has a value of either 'false' or 'true' (indicating it is 'deselected' & 'selected'), it shouldn't return a value of "" or null. Therefore, the first if statement is never true, and your dialog will never appear.

我相信您想要的是,如果未选中复选框,则必须在输入中输入客户 ID.如果是这样,我认为这是您想要的代码:

I believe what you want is that if the checkbox is unselected, there must be a customer ID entered in the input. If so, I think this is the code you want:

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();
    }
}

这篇关于使用 SSJS 的保存按钮不会在 web xpage 中打开 xe:dialog 但可以在移动 xpage 上打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆