Skip to content
This repository was archived by the owner on Nov 29, 2021. It is now read-only.
This repository was archived by the owner on Nov 29, 2021. It is now read-only.

When we do not specify value attribute, an empty string is sent to a server #8

@plashenkov

Description

@plashenkov

When we use a plain checkbox element, we do not need to explicitly provide a value attribute. When checkbox is checked, a "on" value is sent to the server on form submit.

For this component, the value attribute must be specified, otherwise internally the component provides its <input type="checkbox"> with an empty value attribute. And therefore, when checkbox is checked, an empty value is sent to a server on form submit.

I spent a lot of time figuring out what's wrong.

I think that if no value specified for the component from outside, the component shouldn't add the value attribute to the internal <input type="checkbox"> element at all. In this case, browser will sent "on" to the server natively.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions