Location.reload() not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2024 01:20 PM
Hi
i have multi layers of choice questions and I want to clear up the entire form when the top level choice value changes.
so I have created a catalog client script onChange on the variable that is present at the top level and added the location.reload() function in the script (nothing else). However, even after choice value change for that variable, the form does not reload.
what might be the issue?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2024 08:48 PM
Instead of using location.reload(), you might try another approach to clear the form. For example, you can manually clear each field using client scripts.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue === '') {
return;
}
// List of variables to clear (replace with your actual variable names)
var variablesToClear = ['variable1', 'variable2', 'variable3'];
// Clear the values of each variable
for (var i = 0; i < variablesToClear.length; i++) {
g_form.setValue(variablesToClear[i], '');
}
}
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks