Confirmation for Button control submission

Comments

4 comments

  • Avatar
    Loren Bratzler

    Is your generic button actually doing the Submit?  Or is it something else unrelated to the Submit action?

  • Avatar
    Michael Barath

    It it actually doing the Submit.

  • Avatar
    Loren Bratzler

    You should be able to use the eForm event onBeforeSubmit and put in a JavaScript confirm dialog something like this:

    eFormEvents.onBeforeSubmit = function (callback) {

       /* insert any additional logic you need here */

       if (confirm("You have chosen to Submit this form.\n\nIf this is correct, click OK.\nIf this is not correct, click Cancel to return to the form.")){
          callback (true);
       } else {
          callback (false);
       }
    }

    This will present the user a pop-up dialog box with an OK and Cancel button.  If they click the "OK" button (confirming the action) then the callback true is executed allowing the form to submit.  If they click "Cancel", then callback false is executed and the form does not submit.

    It may not be the prettiest solution since you can't really modify the appearance of the Confirm dialog (or the buttons it shows) but it should work.

    Here is a link to the documentation on eForm events:

    https://documentation.agilepoint.com/00/appbuilder/cloudformEvents.html

  • Avatar
    Michael Barath

    Thank you again, Loren. You're right, it's not very pretty, but it will save my users some headaches. And thanks for the event documentation. I hadn't seen that before. 

Please sign in to leave a comment.