- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-07-2024 12:12 PM - edited ‎10-07-2024 12:48 PM
I want to have an onchange client script that when the category field is changed it confirms that the field is changed, if the user doesnt want to change then it goes back to the previous category, for some reason when i select cancel it sends me into a loop of asking for the confirm message over and over.
var confirmChange = confirm('Are you sure you want to change the Category?');
if (confirmChange) {
g_form.save();
} else {
g_form.setValue('u_category', oldValue);
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-07-2024 04:02 PM - edited ‎10-07-2024 04:03 PM
I don't see any update. but I tried your client change on the incident table 'category' field. And came up with the following for the client script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if (oldValue == newValue) {
return;
}
var confirmChange = confirm('Are you sure you want to change the Category?');
if (confirmChange) {
g_form.save();
} else {
g_form.setValue('u_category', oldValue);
}
}
I added a check to prevent the loop. Lines 6 - 8.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-07-2024 12:34 PM
You should post more context. I'm sure someone here can assist.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-07-2024 12:48 PM
updated
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-07-2024 04:02 PM - edited ‎10-07-2024 04:03 PM
I don't see any update. but I tried your client change on the incident table 'category' field. And came up with the following for the client script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if (oldValue == newValue) {
return;
}
var confirmChange = confirm('Are you sure you want to change the Category?');
if (confirmChange) {
g_form.save();
} else {
g_form.setValue('u_category', oldValue);
}
}
I added a check to prevent the loop. Lines 6 - 8.