How to use GlideAjax in on submit client script

KARAN24
Tera Contributor

Hi Team,

I have to do a validation on one variable called tax id ,if the tax id  does not exists in account table ,it  clear out the value, and is happening with On change client script.But it should not allow to submit the form.But form submission is possible.How can we validate that field on oN Submit.

 

Thanks,

Karan

13 REPLIES 13

@KARAN24 

that should not be ideally the case.

if the validation fails you are clearing the value and making it mandatory; then how user can submit form with empty mandatory field?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar ,

I guesss the issue is it is not waiting till we get response from the server side.

Thanks,

Karan

@KARAN24 , not sure if you go the chance to look into the response shared at the top, the same thing I have already mentioned

Best Regards
Aman Kumar

@KARAN24 

Refer these links for workaround/solution on how to use Synchronous GlideAjax in onSubmit

How To: Async GlideAjax in an onSubmit script

Asynchronous onSubmit Catalog/Client Scripts in ServiceNow

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader