Restrict the selection to three checkboxes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2024 02:13 PM
Hello All,
I have a situation where the user can select only up to 3 check boxes as shown below.
However, I wrote an onChange script for all the four checkboxes as follows:
This is working exactly the way it should be but the issue is if I select 3 options and click on the fourth one, it just locks away the selected options and if I want to unselect a checked option and select another one, that's when it is not allowing me to do so. I have to refresh my page and start over again. Does anybody knows how to fix this?
If I unselect everything, the option I tried to select becomes read only.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2024 02:41 PM - edited 08-08-2024 02:42 PM
Hi,
I'm unsure if you wrote the script yourself or if you pulled it from another post on the forums as that code is similar to others that are posted here. With that said, it's unclear if you know fully what it's doing which would help us help you, but from a very high level, it's probably because you have 4 different checkbox fields and this onChange is only going to trigger off of 1 field that you specify, so were you going to make 4 different onChange client scripts? Or how were you planning to address that?
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2024 02:50 PM
Hello Allen,
The script is picked from one of the solutions provided.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2024 02:58 PM
As mentioned, I created 4 different onChange scripts

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2024 03:03 PM
Hi,
Thanks for confirming. Your post doesn't call this out very clearly, which is why I asked. You said you wrote an onChange client script for the 4 checkboxes, but that could be interpreted as one script...where you are checking the 4 checkboxes (which is what this script is doing).
In any case, when you said this:
@RohanDS wrote:
I select 3 options and click on the fourth one, it just locks away the selected options
In theory it shouldn't do anything because clicking the 4th option would already be read-only, thus it doesn't do anything when you click it. If there's still an action happening when you click on the 4th option, then there may be another issue going on.
Since you have newValue == '', then when the checkbox gets unchecked, the script wouldn't run.
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!