Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support indeterminate checkbox #1333

Closed
dwidge opened this issue May 2, 2024 · 2 comments
Closed

Support indeterminate checkbox #1333

dwidge opened this issue May 2, 2024 · 2 comments
Labels
Type: Feature New features and feature requests

Comments

@dwidge
Copy link

dwidge commented May 2, 2024

request

Show an indeterminate checkbox when its value is undefined?

When a boolean value is optional and was never clicked by the user, it submits undefined. If the user clicks the checkbox twice it submits false. If they click a third time, can it become undefined again?

notes

https://css-tricks.com/indeterminate-checkboxes/

https://www.w3schools.com/jsref/prop_checkbox_indeterminate.asp
A checkbox cannot be set to indeterminate state by an HTML attribute - it must be set by a JavaScript.

document.getElementById("myCheck").indeterminate = true;

packages

import ZodBridge from "uniforms-bridge-zod";
import { AutoForm } from "uniforms-mui";
import { AutoForm } from "uniforms-unstyled";
@mariusrak
Copy link
Contributor

You can, and probably should, implement it by yourself outside of uniforms, since it is not standard behavior. You can simply create custom fields https://uniforms.tools/docs/examples-custom-fields/

@piotrpospiech
Copy link
Collaborator

Hi @dwidge, as @mariusrak wrote, creating a custom field for such a scenario will be the best approach.

@piotrpospiech piotrpospiech added the Type: Feature New features and feature requests label May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature New features and feature requests
Projects
Status: Closed
Development

No branches or pull requests

3 participants