0
votes

I've working code to open dialog box using SSJS code to show error or warning to user when user click submit button. This button appears at the top of the xpage.

Applied the modified version of the above code in another application but instead of top of xpage, put button in section. If comboBox1 has initial value it is suppose to popup the dialog box. But it is not working. The client side validation is off in working as well as non working application. Why this code is not working? Where to check?

Here is code for a section button:

<xp:button value="Must click to Assign Quote Number" id="button6" style="width:207.0px">
                            <xp:eventHandler event="onclick" submit="true" refreshMode="complete" immediate="false" save="true">
                                <xp:this.action>
                                    <xp:executeScript>
                                        <xp:this.script><![CDATA[#{javascript:var comboBox1:com.ibm.xsp.component.xp.XspSelectOneMenu = getComponent("comboBox1");
var a=comboBox1.getValue();
if ( a=="Assign the PE Staff"){
    var d=getComponent('dialog2');
    d.show();
    }

}]]></xp:this.script>
                                    </xp:executeScript>
                                </xp:this.action></xp:eventHandler>
                        </xp:button>
1
Can you explain why client-side validation is off? - D.Bugger
To see validation messages in error control, put client side validation off. - Mohan Gangan
IMHO you don't need a round trip to the server, or do you plan to do much more in the code for the button? And a check: has the combo box the same name comboBox1 in both cases? - D.Bugger
Client validation off: For all required fields, I'm using error control to display required message for all fields when user click submit. These messages guiding user to fill only required fields and saves time on entering. comboBox1: Yes it has the same name from working application in this new one. - Mohan Gangan

1 Answers

0
votes

Things to check off the top of my head:

  • Check that Ext Lib is loaded properly in new app (check application properties)
  • Check that namespace for ExtLib is on the new page (drag any Ext Lib control on the page, and this will be added for you)
  • Check that resources from the first page are on the new one (script libraries, etc)
  • Try print("var a=" + a) to see if comboBox1 is giving you a value (check your server log.nsf)

If you give more info on what is happening when it doesn't work then we might be able to suggest more things to check.