Disable Checkbox after checking another checkbox - one of them is in an array

For example, as a GET request:
?group=value4&4.2=4.2&4.3=4.3

Or as a POST request:

group: value4
4.2: 4.2
4.3: 4.3

In both cases it’s just the name/value information that the form sends. Not ID’s.
That’s how forms work.

Yes, I am totally aware of that. But I was wishing that the disable function would only have to use the ID’s to do the job - that’s all.

Again, yes, I understand that. I just didn’t want to change anything that has already been working. For some reason, about a day or so ago I though it would be good to have a disable function, so I wanted to see if that could be done with using ID’s and JS; only having to make those additions to the existing code.

Had time to look over my existing setup. I make the first 3 radio buttons with the same name. I now have (4th) an array for checkboxes.

So to simplify, if a radio button is pushed, then the checkboxes are uncheckable.

Then I need the ability for user changing mind and if the user now wants to use checkbox as selection, there needs to be a way to clear so as to be able to use checkbox. As soon as use checkbox, the 3 radio buttons are disabled.

The name for the checkbox must remain the same for all because only the values will change upon the selection based on the existing array.

I don’t need css, just want to add JS for the above and perhaps put an id, if necessary, in the input property.

Not sure if this clarifies, hope it does!

I think what you mean by “disable” is what I would call “unselect”. I’m guessing what you are wanting is kind of “nested options”? eg.

choose one appetizer
○ soup
○ garlic bread
○ cheese
⌾ Salad :ballot_box_with_check: lettuce ☐ onion :ballot_box_with_check: tomato ☐ olives

Yes, I meant to say unselect.

But what I would like is to somehow not have to use a radio button to show the checkbox.

Layout would be more like this with the checkbox in an array down the page.
○ soup
○ garlic bread
○ cheese
☐ item1
☐ item2
☐ item3
☐ item4

Just need to clear selections and go back to radio if needed. Perhaps if you check again on a checkbox that is already checked it clears.

Is there a way of presenting that information so that people can tell just by looking at it, how it will behave?

If people need to mess around with it to understand that clicking a checkbox will disable the options, that tends to be called a bad user experience and is best to be avoided.

When someone selects check2, then check4, then after some deciding check1, then they select an option and all of their checks disappear - that doesn’t make friends of your customers.

I have that now, and after tracking what users do for almost 20 years, they don’t necessarily know what they want, often change their minds and like to click on buttons and check boxes. I am trying to eliminate that so if they select #1, #2 or #3 *(radio buttons) they don’t get to select the list (checkboxs) in #4. It’s really that simple. And here’s the but, if they change their mind and want to go back to #1 after selecting items in #4 - they can.

After they’ve selected a #1 option and the checkboxes are unable to be selected, that seems to totally prevent any possibility of selecting a checkbox until they reload the website. What are the options that would require such a draconian behaviour?

#1 is a package of items preselected for them. Those items are also in the list in #4 along with other items. Many users at first decide on #1 and then later decide for the same price, they want a different selection by going to #4 and picking from a list but not the entire list. So if that happens #1 is selected and separate items in #4 are also selected. So when they submit their request (even though it is made clear to the user that you can’t select both #1 and #4), I have to have asp code that says that they can’t select both, go back and make the proper selection. I don’t want to arbitrarily decide that one selection overrides the other, so the user has to go back. So I was trying to help with their user experience by disabling as we have discussed because the user often doesn’t read and they just want to click or select without thought.

It seems then that an option for the group of checkboxes is the perferable user experience, as that automatically removes the possibility of #1-#3 being selected as well. It also seems to be more feasable when selecting a checkbox autoselects the #4 option too.

I appreciate the thought but it’s really not. I have a lot of items in #4 and the user can individually pick items in #4 depending on the price and it’s impossible to preselect all the options. I need to keep the list in #4 and have a few options in #1, 2,3. I have asp code that covers the incorrect multiple selections and apparently this is going to be difficult to accomplish through JS and since you are one of the best at it, I will assume that it can’t be done because it’s too complex. I must have been wrong in thinking it could be done with if then conditions in JS as it is easily done with asp. Again, I was hoping that the users experience would improve with disabling per our discussions. Thanks I appreciate your time. There’s really no need to keep this thread going as it’s getting extremely redundant. I can always present to other forums and if unsuccessful I will just continue with asp on submission. Thanks again.

It can definitely be done, but a lack of details on the items involved is severely hampering the process.

Additionally, I am wanting to approach this in such a way that you learn how to do it yourself, instead of being spoon-fed precise custom code.

It’s just that none of what you’re presenting makes a good case for the behaviour that you claim to want.

I don’t think it’s up to you to decide how I run my business.

There has been no lack of details in my ask. You knew what was needed near the beginning and your obstinate attitude is totally unnecessary. I find that it’s has been a mistake to engage in this behavior with you in the many unnecessary posts.

Thanks for the offer to learn from you but in all due respect I think I will pass.

The closest example I can think of that’s similar to what you’re describing is some install “wizards” I’ve seen. In particular, a pane with three options eg.

  • minimal
  • default
  • custom

It is only after selecting custom that the wizard presents a new pane with individual options.

The options typically have short descriptions (eg. necessary …, usual …, advanced …) to improve the UI.

Maybe instead of trying to use JavaScript to work with a single “all the options” form, it would be better to break it into chained selects?

Thank you for your suggestions and they are good ones but because the nature of the business I need all options available together. Actually, it’s really not a problem as is, I was just looking for a simple solution to disable with JS. ASP code is doing it great now if user is in a clickable state of mind! Just trying to do different things with certain code. Again, thanks for the time to write this post, it’s very much appreciate.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.