This example shows the most basic form.
Enquiry captures submit events and reads data from the form.
Form validation is done by supplying a validation function as an attribut to your inputs. A validation funciton takes two arguments: (value, values)
.
Reform captures submit events and reads data and validates the form.
Form validation is done by supplying a validation function as an attribut to your inputs. A validation function takes two arguments: (value, values)
. Value contains the current value, values contains
all values in the form as a javascript object.
The validation
attribute can be either a function or an array of functions, where each validation is only executed if the previous validation was successful.
Reform captures submit events and reads data and validates the form.
Enquiry does not handle display logic. Instead, capture validation errors inside your component state and render where appropriate.
Note how validation is chained for super-re-useability
You can set an `onChange` on your input, just like you would do in a "plain old form". Enquiry stil keeps track of your values and validations.
Type something to move the progress-bar. Hit submit to trigger validation
Form validation is done by supplying a validation function as an attribut to your inputs. A validation funciton takes two arguments: (value, values)
.
Reform captures submit events and reads data and validates the form.
Sometimes you want to know if the form could be valid without actually validating the form. You can make a ref to your form and call isTentativelyValid
. This will return an object with true
or
false
for each form element.
You can create sub-form components using the Fieldset
or FieldWrapper
components.
const Fieldset = require("enquiry/fieldset");
const FieldWrapper = require("enquiry/field-wrapper");
Enquiry needs to be able to reach the children of each child-component. You must define a ref attribute on your Fieldset or FieldWrapper for this to work.
Functional components don't support refs yet. You need to create a manage component (using class
or React.createClass
)