Browse Source

Improve docs for select multiple (#9539)

* Readd original select multiple note

* Update forms.md
main
Josh Hawkins 8 years ago
committed by Dan Abramov
parent
commit
f39926bcb8
  1. 8
      docs/forms.md

8
docs/forms.md

@ -182,6 +182,14 @@ class FlavorForm extends React.Component {
Overall, this makes it so that `<input type="text">`, `<textarea>`, and `<select>` all work very similarly - they all accept a `value` attribute that you can use to implement a controlled component. Overall, this makes it so that `<input type="text">`, `<textarea>`, and `<select>` all work very similarly - they all accept a `value` attribute that you can use to implement a controlled component.
> Note
>
> You can pass an array into the `value` attribute, allowing you to select multiple options in a `select` tag:
>
>```js
><select multiple={true} value={['B', 'C']}>
>```
## Handling Multiple Inputs ## Handling Multiple Inputs
When you need to handle multiple controlled `input` elements, you can add a `name` attribute to each element and let the handler function choose what to do based on the value of `event.target.name`. When you need to handle multiple controlled `input` elements, you can add a `name` attribute to each element and let the handler function choose what to do based on the value of `event.target.name`.

Loading…
Cancel
Save