Skip to content

Parsing checkbox value "on" as a bool #50

Open
@alexflint

Description

If I write an html form with a checkbox that has no explicit value attribute then when the checkbox is checked by the user the browser will send the string "on" in the form data. However, the string "on" is not recognized by strconv.ParseBool and I get a parse error. It would be nice if this library handled this case.

I realize that I can work around this by setting value="true" in my HTML form but I was wondering whether you would consider making that unnecessary by processing the string "on" as true when parsing booleans.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions