When creating a Catalog Form in ServiceNow, by default, the Order Now button in the form will be visible.
You can hide the Order Now button using a Client Side Script. If you inspect the button in your web browser, you should see that the ID of the button is submit-btn.
In ServiceNow, I start by selecting All > Studio and then selected my app. Near the bottom of my Catalog Item app I select the Catalog Client Scripts tab and select New.
For example, the following Client Side Script can be used to hide the Order Now button when foo does not equal bar.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var foo = g_form.getValue('foo');
foo = foo.toString().trim();
// if the foo variable does not contain the value bar display error message and hide the Submit button
if (! /^(bar)$/.test(foo)) {
g_form.addErrorMessage("foo does not equal bar");
this.jQuery("#submit-btn").hide();
return;
} else {
// display the Submit button
this.jQuery("#submit-btn").show();
}
}