Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

adding confirmation disclaimer onSubmit() catalogue client script

Varun Sharma
Tera Expert

Hi Experts, 

 

I've a requirement to add a disclaimer on submit of a form( like a confim box of Javascript) , if user accepts the form should get submitted but if the user rejects the form submission should be aborted.

Please suggest me how i should proceed with it , i'm stuck using the spModal method, 

// it always returns false, and keep giving me error message over and over again. 
function onSubmit() {
    var isFormSubmitted = false;
    if (isFormSubmitted) {
        return true;
    }
    spModal.open({
        title: 'Confirm Action',
        message: '<strong>IMPORTANT</strong>: <p style="color:red">Need Plenty of HTML here for hyper Link and emphasis.</p>',

        buttons: [{
                label: 'Accept',
                primary: true,
            },
            {
                label: 'Decline',
                cancel: true,
            }

        ]
    }).then(function() {
        g_form.addInfoMessage("You Accepted the disclaimer.");
        isFormSubmitted = true;
        setTimeout(function() {
            g_form.submit();
        }, 2000);
    }, function() {
        g_form.addErrorMessage('You declined the disclaimer.');
        isFormSubmitted = false;
		return false;
    });

    return false;
}

 

All help is deeply appreciated. 

 

Regards, 


Varun Sharma

1 ACCEPTED SOLUTION

Sandeep Rajput
Tera Patron
Tera Patron

@Varun Sharma Please refer to this post https://www.servicenow.com/community/developer-forum/confirm-box-using-client-script/m-p/1430048 to know how a confirm box can be used to take confirmation from the user.

 

Hope this helps.

View solution in original post

1 REPLY 1

Sandeep Rajput
Tera Patron
Tera Patron

@Varun Sharma Please refer to this post https://www.servicenow.com/community/developer-forum/confirm-box-using-client-script/m-p/1430048 to know how a confirm box can be used to take confirmation from the user.

 

Hope this helps.