- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2016 03:44 AM
Hello All,
I need to clear the of the catalog form while clicking on add to cart.I wrote a script in on submit to clear the value.But it will not store in the table.Can you please suggest a solution for this?
Thanks
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2016 06:14 AM
So, it sounds like you want to clear all form fields onSubmit, when a user clicks the add to cart button? It also sounds like, since you're clearing form values onSubmit, before the RITM is added to the user's cart, all of the variable values are empty in the cart.
I think a simple way around this would be to redirect the user on the client-side with an onSubmit client script. You could redirect the user to the current catalog item - grab its unid dynamically - using window.location = x; This will add the item to the user's cart and reload the current form.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2016 03:50 AM
what is that you want to clear?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2016 06:14 AM
So, it sounds like you want to clear all form fields onSubmit, when a user clicks the add to cart button? It also sounds like, since you're clearing form values onSubmit, before the RITM is added to the user's cart, all of the variable values are empty in the cart.
I think a simple way around this would be to redirect the user on the client-side with an onSubmit client script. You could redirect the user to the current catalog item - grab its unid dynamically - using window.location = x; This will add the item to the user's cart and reload the current form.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2016 06:17 AM
So, for instance:
(this part may change depending on how your catalog is set up)
var unid= gel('sysparm_item_guid').value;
window.location = '/com.glideapp.servicecatalog_cat_item_view.do?v=1&sysparm_id=' + unid;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2016 06:25 AM
I take that back - that's a terrible solution! You can just use location.reload(true);
instead.