MT

In a multipage (ARIS 9.7) dialog I want to validate the input when the OK button is pressed. In case of invalid data the dialog may not be closed. This leads to the following questions.

1. Is there a way to create an eventhandler for the OKbutton ( 'this.OK_pressed = function()'  does not work)) ?

2. Is there a way to prevent the dialog from closing when the OK-button is pressed (assuming that there is a solution for the first question), and how do I close the dialog 'manually'?

3. Is it possible to prevent automatic generation of the Ok and Cancel button?

by Robert Goldenbaum
Badge for 'Question Solver' achievement
Posted on Tue, 09/08/2015 - 13:28

Hi,

1) not that I know - I tried this for some time but didn't find anything

2) no

3) no

But why don't you just check the values after the dialog and then open it again if the results where not ok ?

BR Robert

0
by Martin Tebbenhoff Author
Posted on Wed, 09/09/2015 - 10:28

Hi Robert, 

Thanks for the suggestion. But Dialogs.show() and Dialogs.createUserDialog() are deprecatedas so we are forced to use the Dialogs.showDialog() function. Using the example in the help and overriding the .getResult() function in the dialog gives me the output I need, but then I cannot determine whether the OKButton or the Cancel button was hit.

When I do not override the getResult() it gives me an integer to identify the button used, I have not found out yet how to get the values from the dialog after the dialog has closed while using the Dialogs.showDialog() function.

Here is a simple example of what I need. Can you help me out with the two statements at the bottom?

function myDialog() {
    this.getPages = function() {
        var iDialogTemplate0 = Dialogs.createNewDialogTemplate(569,305, 'Page1');
        iDialogTemplate0.TextBox(66, 108, 372, 15, 'NAME');
        return [iDialogTemplate0]; 
    }
    this.init = function(aPages) {
        this.dialog.getPage(0).getDialogElement("NAME").setText("Default");
    }
    this.isInValidState = function(pageNumber) {
        var name = this.dialog.getPage(pageNumber).getDialogElement("NAME").getText();
            if (name == "" || name === undefined) {
                return false;
            }
            return true;
    }
    this.onActivatePage = function(pageNumber) {
    }
    this.canFinish = function(pageNumber) {
        return true;
    }
    this.canChangePage = function(pageNumber) {
        return true;
    }
    this.canGotoNextPage = function(pageNumber) {
        return true;
    }
    this.canGotoPreviousPage = function(pageNumber) {
        return true;
    }
    this.onClose = function(pageNumber, bOk) {
    }
    this.getResult = function() {
        return this.dialog.getPage(0).getDialogElement("NAME").getText();
    }
 }

 function main() {
    var Result = Dialogs.showDialog(new myDialog(), Constants.DIALOG_TYPE_WIZARD, "M@ CopyView");
    //var buttonPressed = ???
    //var enteredName = ???
 }
 main();

 

0
by Martin Tebbenhoff Author
Posted on Wed, 09/09/2015 - 11:17

Just found out. If I do not override getResult() I get the integer that identifies the button used.

To get the data i can define a global object DialogData and fill it in the onClose() function. After that I can use the DialogData object to extract the entered data when the dialog has closed. You can also use the boolean bOk to pass some kind of status to the main script.

    this.onClose = function(pageNumber, bOk) {
        DialogData = { Name :  dialog.getPage(0).getDialogElement("NAME").getText(),
                                nextitem : .......
        }
    }

 

0

Featured achievement

Rookie
Say hello to the ARIS Community! Personalize your community experience by following forums or tags, liking a post or uploading a profile picture.
Recent Unlocks

Leaderboard

|
icon-arrow-down icon-arrow-cerulean-left icon-arrow-cerulean-right icon-arrow-down icon-arrow-left icon-arrow-right icon-arrow icon-back icon-close icon-comments icon-correct-answer icon-tick icon-download icon-facebook icon-flag icon-google-plus icon-hamburger icon-in icon-info icon-instagram icon-login-true icon-login icon-mail-notification icon-mail icon-mortarboard icon-newsletter icon-notification icon-pinterest icon-plus icon-rss icon-search icon-share icon-shield icon-snapchat icon-star icon-tutorials icon-twitter icon-universities icon-videos icon-views icon-whatsapp icon-xing icon-youtube icon-jobs icon-heart icon-heart2 aris-express bpm-glossary help-intro help-design Process_Mining_Icon help-publishing help-administration help-dashboarding help-archive help-risk icon-knowledge icon-question icon-events icon-message icon-more icon-pencil forum-icon icon-lock