Client Script setting a checkbox to true is not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2022 09:27 AM
Hello all,
I have multiple choice field, with three choices. The following client script does not seem to work. I want to set a checkbox to true depending on the multiple choice selected on the catalog item,
Type is onchange
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if (newValue == 'OTC') {
g_form.setValue('otc_lm_cash', 'true');
}
else if (newValue == 'RTR') {
g_form.setValue('rtr_icrecon', 'true'); g_form.setValue('rtr_lm_cash', 'true');
}
else if (newValue == 'PTP') {
g_form.setValue('payment_processing', 'true');
}
}
- Labels:
-
Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2022 10:12 AM
Hello Shloke,
When I opened the thread there were no answers on it till the time I wrote the changes and replied multiple people had given their comments, So not like I did not read the thread more like there was no thread when I had opened it.
But still I have deleted my comments.
Cheers!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2022 11:52 AM
Hello,
how do I place an alert ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2022 12:44 PM
Jazz Inside every if add Alert('inside if 1 '); etc 2 n 3 That would help you understand where it's wrong. I would recommend you to read Marks comment. That config is done or not for client script just verify.
Hit helpful if it was
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2022 11:51 AM
Hello,
I have removed the quotes around true and this still does not work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2022 08:09 AM
Hi,
okay not an issue. We can debug this further and get you to a solution.
Can you confirm below two things to help you further?
1) The script which you have written , is it a Catalog Client Script or Client Script?
2) When you are trying to set a value say for example "otc_lm_cash" . So is this a variable or a field on a form when RITM is submitted.
Assuming you are writing this script as a Catalog client script and "otc_lm_cash" is an variable, you need to use below script:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if (newValue == 'OTC') {
alert('111 ' + newValue);
g_form.setValue('otc_lm_cash', true);
}
else if (newValue == 'RTR') {
alert('222 ' + newValue);
g_form.setValue('rtr_icrecon', true);
g_form.setValue('rtr_lm_cash', true);
}
else if (newValue == 'PTP') {
alert('333 ' + newValue);
g_form.setValue('payment_processing', true);
}
}
So I have placed an alert in all 3 places of your IF block, check in which block of code is getting executed.
Also can you show me the script screenshot to make sure you have selected the variable name correctly in your On Change Script?
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke