Disable the submit button on record producer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2017 07:27 AM
I am trying to disable the submit button on a record producer based on the answer of a variable in a catalog client script.
However, when you change this variable back to "--None--" the button still shows as disabled. When the variable is "--None--" the button show still show as enabled.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if (newValue == 'no') {
alert('Test.');
document.getElementById("submit_button").disabled=true;
}
else {
document.getElementById("submit_button").disabled=false;
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2017 07:30 AM
HI Josh,
Since DOM manipulation is unsupported and risky, wouldn't it make more sense to make the field mandatory? You cannot submit if there are unfilled mandatory fields.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2017 07:33 AM
Hi Chuck,
The requirement is that the user should not be able to submit the form if the answer to the variable is "No".
Thanks,
Josh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2017 07:38 AM
You can write a onSubmit client script for that.
If it is no, then you did not submit the form.
refere 4.4, http://wiki.servicenow.com/index.php?title=Client_Scripts#How_do_I_cancel_a_form_submission.3F

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2017 07:38 AM
Unfortunately there is no OOB supported way to disable the Submit button. The first solution that comes to mind is making a choice list variable (mandatory) that says something like:
* I agree to the terms and conditions stated above (choose I accept):
The only choices are --None-- and I accept.