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 09:40 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2022 09:41 AM
Hello,
You need to set the checkbox value without putting true inside the inverted commas
Please use the below:-
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);
}
}
Please mark answer correct/helpful based on Impact
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2022 10:00 AM
Hey @saurav
Please do not duplicate the thread answer by giving the same reply which I have already provided above.
Would suggest please go through the thread before posting your comments in.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2022 10:08 AM
When I opened the thread there was no replies on it, till I finished typing and clicked on reply there were multiple answers already, so not really did i had a chance to read the thread as there was none when I opened it.
But still will delete my answer.
Cheers!!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2022 02:46 AM
Checked with the following script. I've added code to uncheck choices that were selected by earlier choices.
function onChange(control, oldValue, newValue, isLoading) {
if (newValue == '') { // deleted onloading so default choice will run
return;
}
if (newValue == 'OTC') {
g_form.setValue('otc_lm_cash', 'true');
g_form.setValue('rtr_icrecon', 'false');
g_form.setValue('rtr_lm_cash', 'false');
g_form.setValue('payment_processing', 'false');
} else if (newValue == 'RTR') {
g_form.setValue('otc_lm_cash', 'false');
g_form.setValue('rtr_icrecon', 'true');
g_form.setValue('rtr_lm_cash', 'true');
g_form.setValue('payment_processing', 'false');
} else if (newValue == 'PTP') {
g_form.setValue('otc_lm_cash', 'false');
g_form.setValue('rtr_icrecon', 'false');
g_form.setValue('rtr_lm_cash', 'false');
g_form.setValue('payment_processing', 'true');
}
}
I've set OTC as the default choice on variable "wipro_tower_2".
Execution result: