Onchange client script to trigger alert if old value is not equal to new value
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2024 10:48 AM - edited 08-19-2024 10:53 AM
Hi,
I am trying to trigger an alert if user selects different choice apart from default choice. I set the default choice based on different field.
And below code works fine for that functionality if I dont add that validation of checking oldvalue is null. But, i want it to trigger if oldvalue is not null or empty and that is not i can not figure out.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
if (oldValue.length > 0) {
console.info("old value is null: " + oldValue);
if (newValue !== oldValue) {
alert("Note: Changing the choice is not recommended.");
}
}
}
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2024 12:54 PM
@Community Alums Nope like kb article, i still get oldValue or original value as "" even i though i select different choice.