Hide Submit Button Based on Variable Selection in Question

kathymorris
Tera Contributor

Hi All,

 

We have a requirement to hide the Submit button, not for the entire catalog item, only when a user selects a certain answer/variable in the drop-down selection box of the Question asked. There was discussion of manipulating the DOM however, it was mentioned that this  can break during an upgrade. What other options do we have? How can we do this without breaking the code during an upgrade or breaking best practice rules? 

 

Right now, the user clicks the Submit button, and a print error displays on the screen, telling them to click a URL instead. The user is not able to submit the record.

One other option would be when the user selects the Submit, to automatically open the URL. 

 

Best,

 

 

Kathy

 

 

 

 

3 REPLIES 3

Community Alums
Not applicable

Hi @kathymorris ,

I'm not aware of any supported methods of doing this. You may be able to achieve with DOM manipulation if you find the HTML element ID of the submit button.

You can however, validate input with an onSubmit client script, where you could print an error and return false which would abort the submission, if the variable is false. That would functionally achieve they same thing and would be much easier to do.

 

Hi Sandeep, 

 

As mentioned, we do have a printer error message when the user selects submit. Which is a less desirable design. If the user is not supposed to select Submit, the button should not be there.  We are aware of the DOM manipulation--however this could break during an upgrade correct? 

Seems like there should be some way to do this in ServiceNow without breaking code or having issues later. 

 

Thanks,

Kathy

Community Alums
Not applicable

Hi @kathymorris ,

 Absolutely !! DOM manipulation is not recommended by serviceNow.