How to display a confirmation pop up message on a widget

Alessia Russo
Tera Expert

Hi everybody! 

I need to display a confirmation pop up in a SR when the user click on Submit. In the pop up it should say "Are you sure you want to continue?" and there should be 2 bottons as Continue or Cancel. So when they click on continue the sr is submit, if they click cancel the action is aborted and they rest in the page without having send the sr.

I need this pop up in a widget so somebody could help me?

Thanks.

 

6 REPLIES 6

Jack Littlewort
Giga Guru

Are you looking to have this on the portal?

yes it's a widget display on a portal

Hi,

 

 

The simple way to do this is a confirm dialog. But the buttons are OK and Cancel

 

 

function onSubmit() {
   //Type appropriate comment here, and begin script below
   return confirm("Are you sure you want to continue?");
}

 

A slightly more complex version would be the following: (please note this only works on the portal)

 

 

if (typeof spModal != 'undefined') {
        if (g_scratchpad.isFormValid) {
            return true;
        }
        spModal.open({
            title: 'Are you sure you want to continue?',
            buttons: [
                {label:'Cancel', cancel: true},
                {label:'Continue', primary: true}
            ]
        }).then(function(confirmed) {
            g_scratchpad.isFormValid = true;
            var actionName = g_form.getActionName();
            g_form.submit(actionName);
            return true;
			
        });
        g_scratchpad.isFormValid = false;
        return false;
    }