onChange script error: RangeError: Maximum call stack size exceeded function () { [native code] }
Community Alums
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2025 05:01 PM
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (!newValue) {
g_form.clearValue('u_caller');
g_form.clearValue('u_email');
g_form.clearValue('u_location');
return;
}
var cal = g_form.getReference('u_caller', getCall);
function getCall(cal) {
g_form.setValue('u_email', cal.email);
g_form.setValue('u_location', cal.location);
}
}
I'm trying to auto populate caller details using callback function , its displaying the values but the function enters into recursive/infinite loop , how to rectify the script error ?
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2025 10:55 AM - edited 03-31-2025 10:56 AM
try adding:
if (isLoading || newValue === '') {
return;
}
at the top of onChange function, before the 'if (!newValue) {' (I suspect that line is a problem, why would the onChange client script run if there is no newValue? See:
check OOG onChange client scripts for working examples.