Closed cherring07 closed 1 year ago
Perhaps undocumented (sorry if I have missed it)
When using the useFormAPI hook with setError within onSubmitI get the following error.
formApi.setError is not a function
const Test= () => { const formApi = useFormApi(); const onSubmit = () => { formApi.setError('example', 'error!'); }; render ( <Form onSubmit={onSubmit}> <Input name="example" label="Example" /> <button type="submit">Submit</button>) </Form> ); }
You are outside the context of the form.
<Form
<Form formApiRef={someRef}
Then you can do formApiRef.current.setValue('example', 'Foo') as an example
formApiRef.current.setValue('example', 'Foo')
Perhaps undocumented (sorry if I have missed it)
When using the useFormAPI hook with setError within onSubmitI get the following error.
formApi.setError is not a function