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

Hi,

that is mostly used when we use synchronous GlideAjax

I am not sure if that would help you because if the validation fails the script would stop the form submission

Then user needs to populate the correct value and submit it again so that pass the validation passes and now the form would submit.

Anyhow if user is changing some value he/she has to submit the form inevitably.

Regards
Ankur

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

A4010
Tera Contributor

I have same issue of users have to click twice on submit Button to submit the request when a UI catalog Policy "Show introductory period question if hire date is less than or equal to one year from today's date" is marked Yes. I traced this to an OnSubmit catalog client script validation. Kindly help on resolution.