Save button using SSJS does not open xe:dialog in web xpage but works on mobile xpage

前端 未结 1 495
花落未央
花落未央 2021-01-23 16:03

The following save button code works well on mobile xpage:

var checkBox31:com.ibm.xsp.component.xp.XspInputCheckbox = getComponent(\"checkBox31\");
var customerI         


        
1条回答
  •  失恋的感觉
    2021-01-23 16:48

    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.

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

    0 讨论(0)
提交回复
热议问题