I'm trying to add a date picker to my forum. Problem is the date picker only works through the component state. meaning that the picked values go into the state.
I'm trying to force a final form field to use that state value. But I can't seem to figure it out.
Basically trying to to this:
<Field name="field1" value={this.state.date}/>
Ummmmm, I'm going to assume you wan't to set an initial value that the end user can change. Please let me know if this is not the case.
If you wan't to force a value, don't use a field. React-final-form maintains state so you don't have to.
To set an initial value, use initialValues property in the Form control.
<Form
onSubmit={onSubmit}
initialValues={{ field1: "2019-02-02" }}
render={({ handleSubmit, form, submitting, pristine, values }) => (
<form onSubmit={handleSubmit}>
<div>
<label>Feild One</label>
<Field name="field1" component="input" type="date" />
</div>
.
.
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With