Users have to click twice on submit Button to submit the request due to an OnSubmit catalog client script validation

Shahebaz
Giga Guru

Hello Experts,

We have an onsubmit Catalog Client script that performs some validation and because of this, we have to click the submit button twice to submit the request.

OnSubmit client script contains g_scratchpad variable to stop the form from submitting until validation done

Any suggestion to avoid that twice clicking.

Thanks,

Shahebaz

1 ACCEPTED SOLUTION

Shahebaz
Giga Guru

Thank for your reply experts but somehow I got it here,

https://community.servicenow.com/community?id=community_article&sys_id=e37f2072db9fd0103daa1ea6689619c6

Not sure if it's dependent on the version but on Rome, if the answer function returns true I need to click again on submit button because the actionName variable return "none". I fix it by putting 'submit' in g_form.submit() function.

g_scratchpad.isFormValid = true;
 g_form.submit('submit');

View solution in original post

6 REPLIES 6

Aman Kumar S
Kilo Patron

Share your script, and are you setting return as false in the validation that might be obstructing submission. If your form validation is validation return true, then twice clicking won't be required.

Best Regards
Aman Kumar

Palak Gupta
Tera Guru
Tera Guru

For which reasons you are using g_scratchpad on onSubmit script?

What validations you are checking?

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you are stopping the form submission since validation failed.

So unless user passes the validation the submit button won't allow you to submit the form.

That's how the platform behaves.

Regards
Ankur

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

Shahebaz
Giga Guru

Thank for your reply experts but somehow I got it here,

https://community.servicenow.com/community?id=community_article&sys_id=e37f2072db9fd0103daa1ea6689619c6

Not sure if it's dependent on the version but on Rome, if the answer function returns true I need to click again on submit button because the actionName variable return "none". I fix it by putting 'submit' in g_form.submit() function.

g_scratchpad.isFormValid = true;
 g_form.submit('submit');