Skip to content

[Bug] Checkbox validation does not work (verified in demo app) #89

@lonix1

Description

@lonix1

My model has a bool bound to a checkbox. It's not required, so I should be able to submit the form without checking it. But validation fails for the checkbox and I can't submit.

I tried the demo, and it also fails.

The demo has this:

    [BindProperty]
    public InputModel Input { get; set; } = new();

    // ...

    public class InputModel
    {
        [Remote("CheckboxRemote", "Validations", HttpMethod = "Post")]
        public bool IsChecked { get; set; }
    }

When trying to submit the form on the http://localhost:5000/Demos/Checkboxes page:

NET renders a checkbox and a hidden input ... it is unchecked. Unchecking it should not fail validation.

'IsChecked' is invalid. This is not checked

One can easily verify this repro, just run the demo, go to that page and click submit.

I think it's a bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions