formam icon indicating copy to clipboard operation
formam copied to clipboard

Parsing checkbox value "on" as a bool

Open alexflint opened this issue 7 months ago • 1 comments

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.

alexflint avatar Jul 26 '24 14:07 alexflint