HTML Client | MessageBox to confirm AddEditScreen changes RRS feed

  • Question

  • Hello,

    On the HTML Client, how can i show a Yes or No MessageBox when clicking on the commit button of an AddEditScreen, to ask the user if he wants to confirm the changes? If he answers Yes commit the changes, if he answers No, stays on the AddEdit Scren..

    Best Regards,

    Monday, August 17, 2015 2:45 PM

All replies

  • You can write below code in "beforeApplyChanges" event of you screen:

    myapp.DetailsScreen.beforeApplyChanges = function (screen) {
        msls.showMessageBox(" Message ",
        { title: "Message Title", buttons: msls.MessageBoxButtons.yesNo }).then(function (response) {
            switch (response) {
                case msls.MessageBoxResult.yes:
                    return true;                
                case msls.MessageBoxResult.no:
                    return false;

    • Edited by divyang_dv Monday, August 17, 2015 4:47 PM
    • Proposed as answer by R.T. Watkins Monday, August 17, 2015 6:36 PM
    • Unproposed as answer by Johny Pingo Tuesday, August 18, 2015 10:34 AM
    Monday, August 17, 2015 4:42 PM
  • That's what i tried to implement, the dialog box appears after clicking commit but without clicking yes or no it just advances like i pressed No.

    Is it because when i click commit on the AddEdit Screen the navigation is already in progress and there is nothing i can do?

    Isn't there any solution for this? I have a date field on the add edit screen and under certain conditions i want the user to receive a message to confirm the date is the correct one.
    Tuesday, August 18, 2015 10:28 AM
  • The only thing I can think of is to put "return true;" before the "break;" in the default case and see if the behavior changes from always-false to always-true.  If so, there's a problem elsewhere in the logic.  I wouldn't think you'd need to put a "break;" statement after each of the return statements to keep the code from falling through to the next case statement, but I could be wrong.  Set a breakpoint on the msls.showMessageBox line and step through the code line by line to see what it's doing.

    Good luck!

    Tuesday, August 18, 2015 12:34 PM