Reputation: 809
I need to do some ServerSide(SSJS) control in backend then a confirmation dialog should appear in front of the user. i couldn't write the correct code to be worked.
var cVal = getComponent("fieldName").getValue();
if (cVal != "undefined" || cVal != null || cVal != "") {
var db:NotesDatabase = session.getCurrentDatabase();
var checkView:NotesView = db.getView("viewname)");
var checkDoc = checkView.getDocumentByKey(cVal);
if (checkDoc != null) {
var scriptCode = "confirm ("
Are you sure you want to navigate away from this page ? " + "\
n " + "\
n " + "
Press OK to
continue, or Cancel to stay on the current page.
"))";
view.postScript(scriptCode);
}
/* in this part function should be worked according to user choice. If user click YES the document which is found an backend should be opened. If the user click NO nothing happens. */
Upvotes: 0
Views: 389
Reputation: 15739
This is a common mistake when coding applications after moving from client to web. In client, LotusScript can prompt for user interaction, pause, wait for response, then act on that response.
Unless you're performing everything via Client-Side JavaScript, that's not going to work for the web. There are three options.
Using an XPages dialog will also allow you to style the dialog consistently with your application rather than being forced to accept browser styling which, in some browsers, can be limited.
Upvotes: 2