Reputation: 12729
I am using react-final-form
and TextareaAutosize
in my example .I am trying to get the value of text-area
but not able to do that.
I am able to get value of input
field but not textarea
here is my code https://codesandbox.io/s/react-final-form-simple-example-rd3rc
<div>
<label>Text area Name</label>
<Field
component={TextareaAutosize}
type="textarea"
name="operatingPinCode"
placeholder="Notes"
label="About"
/>
</div>
API link https://final-form.org/docs/react-final-form/examples/simple
https://www.npmjs.com/package/react-textarea-autosize
Upvotes: 1
Views: 3323
Reputation: 11
You can get value by this pop:
`onChange={(event) => { console.log(event.target.value) }}`
Upvotes: 0
Reputation: 507
Your final-form code is working fine. The problem I think lies with TextAreaAutosize, since it doesn't know how to pass data directly to your form. So you might need to add a handler on that field for the onChange event.
Based on the final form documentation, this code sample below seems to work just fine:sandbox-code Just checkout the second attempt section.
Upvotes: -1