- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2024 12:08 AM
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
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2024 08:16 AM
@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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2024 08:16 AM
@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.