- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2016 01:52 PM
i have a onChange catalog client script that DOES change the field values so it is running but it doesn't throw the alert.
if(newValue == 'No'){
alert(getMessage('test'));
g_form.setValue('foo' , 'No')
g_form.setValue('bar' , 'No')
}
--or
if(newValue == 'No'){
alert('test');
g_form.setValue('foo' , 'No')
g_form.setValue('bar' , 'No')
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2016 06:53 AM
clear cache and check to clear form data and that should resolve that part of it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2016 02:25 PM
If you are setting the value of a variable that has an onChange script, it will cause an endless loop unless you have some sort of check. It is not recommended to change the value of a field in its own onChange script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2016 02:41 PM
i am setting the value of the field in this on change script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2016 02:41 PM
try adding an alert before the if statement... this will show you if it is an issue with newvalue or with the if statement. however... as the other person stated.. you shouldn't change a value in an onchange script for itself.... that causes a loop.
alert('new value is ' + newvalue);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2016 02:59 PM
No alert new value when alerting before if..... freaking weird
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2016 02:46 PM
also if that is your entire script you are missing the function calls to allow newValue.... your script should be wrapped inside the function below... you can skip the if for newValue == '' and isLoading if those aren't desired.. <i need some onchanges to run onload also.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
}
