need mutually exclusive checkboxes

I’ve been trying to accomplish something with 3 checkboxes, that need to function like a radio button list, only look horizontal, like in the picture below.

The problem is that whenever i tick an unchecked checkbox, it jumps right back to the default checked one (granularCB ), and it also doesn’t do the logic either. I also need them to be immediate.

public void buttonClick(ClickEvent event) {
				if (granularCB.booleanValue()) {
					granularCB.setValue(isGranular = true);
					singularCB.setValue(isSingular = false);
					uniqueCB.setValue(isUnique = false);
				} else if (singularCB.booleanValue()) {
					granularCB.setValue(isGranular = false);
					singularCB.setValue(isSingular = true);
					uniqueCB.setValue(isUnique = false);
				} else if (uniqueCB.booleanValue()) {
					granularCB.setValue(isGranular = false);
					singularCB.setValue(isSingular = false);
					uniqueCB.setValue(isUnique = true);
				}

EDIT: It kind of works if i untick the currently ticked checkbox before i tick another, but that’s not how it’s supposed to run.
11396.png

Suggest you go back to an OptionGroup (radio buttons) and use CSS to make them appear on the same line. We do this by adding the style name “inline” to option group and CSS like: .inline .v-select-option { display: inline; }

You can search the forums for other similar resolutions to allow OptionGroup to show horizontally.

Hi,

I wrote a small sample here:
uilder.virtuallypreinstalled.com/run/mutually_exclusive_checkboxes/
. Is this the behavior you are looking for?

Thank you, they both answer my problem. Was too late for me yesterday to google, the horizontal radio buttons was at a reference shorthand distance away :grin:


http://www.tizag.com/htmlT/forms.php


HORIZONTAL OPTIONGROUP