Closed xiao-hu closed 5 years ago
How exactly would you use the name
attribute? In an uncontrolled form like this?
<form>
<Switch
name="asdfqwer"
checked={this.state.checked}
onChange={this.handleChange}
/>
<input type="submit" />
</form>
The idea is that I can submit the form in various ways, even something very old fashion like below. There is no need to restrict how it should be use.
<form action='/submit'>
<Switch
name="asdfqwer"
checked={this.state.checked}
onChange={this.handleChange}
/>
<input type="submit" />
</form>
In my use case, I have a general form processor that does some thing to the form using the names of the inputs in the form, i.e., <form onSubmit=(generalFormProcessor)>
. It would be very useful to me if <Switch/>
should be viewed as some sort of <input/>
.
Ok, seems reasonable. I'll try to release it soon.
Released in 4.1.0!
This allows the switch to be used more like a tradition checkbox (issue #36 ).