Checkbox Group Default Values

I have a checkbox group in a form that isn't clearing when form reset is triggered.

I tried setting the default for the checkbox group as: blank, [0], and ['0'] but nothing seems to make reset set the values to defaults.

I don't even need a default to be set, I just need the checkbox group to set everything to unchecked when the form is rest. I can't use clear because other elements on the form need to be set to default values.

Has anyone run into this? Thanks!

@Kristofer_Lyon

What are the values for your options in your checkbox control? You will need to use those values inside of your "Default Value." Once the proper values are set, .resetValue() will then work properly. If this isn't clear, please see the screenshots below for an example of what I mean. Retool defaults to the option value being 'Option 1,' 'Option 2,' ... 'Option {n}'. Therefore to have a certain value selected by default, the default value would have to be ['Option 1']. Changing the value to an integer, I can then the default list by integer. I would just use the label to make a human-readable format that would make sense to end-users.

If the default needs to be nothing, then I would attempt to use [] or null.

Please let me know if this isn't clear, and I'll try to elaborate further.

vs.

So I realized the problem wasn't the default value I was setting. When I run a simple JS query to resetValue() it reverts to defaults. But when I use the form's reset value option it doesn't work. Can I not have a container inside a form? The other input fields reset fine but the checkbox group doesn't seem to work this way.

Can you share more information like a screenshot of the component and the inspector ? Perhaps also try setting to true or false?

When I changed the value of the Client checkbox option from "Client" to 0, reseting now clears all the checkboxes.

When I make the default setting [0] reset does nothing. When the default is set to ['0'], all checkboxes are cleared on reset.

I switched from Safari to Chrome and problems disappeared.

1 Like

Thanks for sharing this update, @Kristofer_Lyon! I've been seeing more and more reports of inconsistent behavior on Safari, which likely merits some additional research. :+1:

1 Like