- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2020 09:50 AM
I have this client script that should only allow 1 checkbox to be selected, but when I test it still lets me select I agree or I disagree. Can someone help me out?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2020 01:05 PM
Another thought is to possibly just ask if they Agree and then have a Yes/No drop down or if it is important that they choose agree or disagree use a multi-Choice box. Both these options could be made mandatory unlike check boxes and they can only chose one. Example of a multi-choice field.
You could also use a select box with options I Agree or I Disagree.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2020 12:18 PM
Hope you had replaced
v_prod & v_replace
with
i_agree & i_disagree
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2020 12:19 PM
Yes I did.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2020 10:29 AM
To meet both your requirements of making at least one checkbox check and not both being checked.
function onSubmit() {
//Type appropriate comment here, and begin script below
if (g_form.getValue('i_agree') == 'true' && g_form.getValue('i_disagree') == 'true') {
alert('You can only select one option');
return false;
} else if (g_form.getValue('i_agree') == 'false' || g_form.getValue('i_disagree') == 'false') {
alert('you must select an option');
return false;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2020 11:30 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2020 11:48 AM
Looks like you have 4 check boxes. What are the variable name for each checkbox? It almost seems like both I Agree and I Disagree have the same variable name which should not be possible.