Repeated Form Submission in Catalog Client Script Using getXML() in onSubmit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
I'm working on a catalog client script where I need to perform a server-side validation during the onSubmit event. The use case is to restrict form submission if the user already has a device listed in the Asset table.
I'm using getXML() to make a GlideAjax call inside the onSubmit client script. The callback function checks the response and conditionally allows or blocks the submission using return false. The validation logic works fine when the condition is met.
However, when the condition fails (i.e., the user should be allowed to submit), the form seems to be submitted multiple times, causing looping behavior. I added an alert() in the else block to debug, and it keeps triggering repeatedly
catalog client script:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
check this link and enhance your script
How To: Async GlideAjax in an onSubmit script
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader