Form
The form object is immutable. It will never change once created. You can safely use it in useEffect. It gives you access to these properties / method :
- onSubmit() prevent the default behaviour of a <form>...</form> HTML element .
- getValues() a method to return your inputs values.
- reset() a method to reset a form.
- each() a method to loop through each input.
- showError() a method that touched inputs and show their error.
- getErroneousInput() a method that get the current erroneous input.
- get() a method that get an input with it's name.
On submit
Help you prevent the default behaviour of a <form>...</form> HTML element
Get your Values
form.getValues() is a practical way to get the values of your inputs at once. The result is an object where the keys match the name of your inputs. If you didn't set name on inputs creation, random ones are used.
Get inputs by name
form.get() let you to get an input by name. It returns an array of input
Show error
form.showError() let your show inputs errors step by step on every invalid input.
Get erroneous input
form.getErroneousInput() let your get the current erroneous input.
Reset inputs
form.reset() reset the value of your inputs
For each input
Hit next to find out how to CONFIG aio-inputsbehaviour.