- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2024 07:11 PM
I have a catalog item then created a catalog client script and Script Include. I used onSubmit since I am not using Service Portal.
This is to check if the new hardware has existing record. If existing, it will not proceed with the request.
If not, it will proceed.
The SI and Catalog client script is working as expected for an existing record.
But for new record, there is an error "The g_form.submit function has no meaning on a catlog item. Perhaps you mean g_form.addToCart() or g_form.orderNow() instead".
Catalog client script
Script include
I change the g_form.submit(); to g_form.orderNow(); but nothing happens when I click Order Now button.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2024 09:00 PM - edited ‎10-20-2024 09:03 PM
It's because you're making an asynchronous call from Client Script. Asynchronous mean in the background, so your form is being submitted before the reply from Script Included.
You'll need to check the value onChange before it's submitted. Create a onChange Client Script on field "shortDescription" and call your Script Include from there instead of onSubmit.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2024 09:00 PM - edited ‎10-20-2024 09:03 PM
It's because you're making an asynchronous call from Client Script. Asynchronous mean in the background, so your form is being submitted before the reply from Script Included.
You'll need to check the value onChange before it's submitted. Create a onChange Client Script on field "shortDescription" and call your Script Include from there instead of onSubmit.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2024 10:29 PM
Thanks @Hitoshi Ozawa - san.
I created onChange for short_description field and call the SI.
Then created onSubmit to prevent the form from being submitted when existing record is found.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2024 11:24 PM
There's 2 ways to do this.
1. Make short_description field mandatory . When there is an error onChange, initialize the short_descripton field. This will cause the form to error when it is submitted because the short_description is empty.
2. Create a hidden true/false field on the form with a default value of true. When there is an error onChange, set this field to false and to revert it back to true when there is no error. Have onSubmit to check that this hidden field is true. Caution: Don't use global variable to hold value instead of hidden field because a user can open 2 forms and the global variable will be shared by these 2 forms.
Method 1 is preferred but it erases what's been entered so user may complain.