I want to make a custom field such that if I check an checkbox, then I want to copy a lot of other fields into another set of fields. E.g. if two types of addresses is the same, I do not want the user to have to write it twice. So I have all the logic to make this happen. The only thing I miss is to update the Form such that the validation function will run, inside the <Form>
from react-final-form
. Is there a way to just update a lot of values inside this form?
Thanks for all help
form.batch
is probably what you want. The FormApi
instance is provided by the <Form/>
component to the render prop.
<Form onSubmit={submit}>
{
({ handleSubmit, form }) => {
// here we can do form.batch()
return <form onSubmit={handleSubmit}>
fields here
</form>
}
</Form>