- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2025 02:15 PM
Hi All,
I have a requirement, there is a field name Nominee type is checkbox. If the user checks the box a disclaimer should populate " You cannot submit" and the Submit button in the portal should be disable of Gradeout. If user unchecks, it should allow user to submit the form. Seeking help!
Thanks in advance.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2025 05:53 PM
@Raji15 Message can be shown easily, however in order to disable the submit button, DOM manipulation via client script will be needed. Please check with your team if they are willing to go that route.
Here is an example of the same.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) return;
// Show or hide disclaimer text
if (newValue) {
// Show disclaimer
g_form.showFieldMsg('nominee_type', 'You cannot submit', 'error');
// Disable submit button
disableSubmitButton(true);
} else {
// Hide disclaimer
g_form.hideFieldMsg('nominee_type', true);
// Enable submit button
disableSubmitButton(false);
}
}
// Helper function to disable/enable Submit button in Service Portal
function disableSubmitButton(disable) {
try {
const interval = setInterval(function () {
const btn = document.querySelector('button[type="submit"]');
if (btn) {
btn.disabled = disable;
btn.style.opacity = disable ? '0.5' : '1';
btn.style.pointerEvents = disable ? 'none' : 'auto';
clearInterval(interval); // Stop once button is found and updated
}
}, 300);
} catch (e) {
console.error("Error disabling submit button:", e);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2025 04:55 AM - edited 04-15-2025 05:14 AM
Hi @Raji15
Could you share the script which you've tried? It'll help us to debug.
Regards,
Siva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2025 06:31 AM
Hi Siva,
Thanks for the reply, I figured out the below working fine. Since the DOM manipulation needed to disable submit button excluding that as of now.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue === oldValue) {
return;
}
if (newValue) {
g_form.showFieldMsg('nominee', 'You cannnot submit, 'warning');
} else {
g_form.hideFieldMsg('nominee', true);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2025 05:12 AM
share your script, script I shared should work fine
try this again
function onSubmit() {
if (g_form.getValue('checkboxVariableName').toString() == 'true') {
alert('You cannot submit');
return false;
}
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader