Resetting/Emptying variable values onSubmit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2020 10:11 AM
I need to do multiple request/order of the same catalog form, using Add to Cart and I need to clear these two fields everytime I click on the add to cart button.
Catalog Client Script doesn't work clearing/resetting/emptying the variables because it affects the RITM/SCtask form too... Would you know other way to fix this? I only need to clear 2 fields out of 5 variables/questions.
Catalog Client Script
Type: onSubmit
Applies on a Catalog Item view: True
Applies on Requested Items: False
Applies on Catalog Tasks: False
UI Type: All
function onSubmit() {
//Type appropriate comment here, and begin script below
g_form.clearValue('install_software');
g_form.setValue('new_hire_software_justification','');
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2020 10:34 AM
Hi nomadie
try with ui policy.
choose your field and there is option Clear the field value . check it
see in below fig.
If it help mark helpful or correct
Thanks and regards
Anil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2020 04:52 AM
UI Policy wont do the work as well. I already tested this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2020 10:41 AM
Hi,
Give it a try. Please check below link.
Out of the box, the cart is contained in a UI Macro called 'catalog_cart_default'. When you press the 'Add to Cart' button, it triggers a function called 'addToCart()' that is contained in the macro. All you need to do is add a single line (reloadWindow(window)); right before the closing bracket for that function.
Let me know if it is useful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2020 04:51 AM
No, I cannot use this option because it will reload the whole page. I need to retain previously entered information. I only need to clear specific variables/questions.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2020 12:03 PM
Sounds like you just need to set the catalog client script to only apply on the Catalog Item view.