React Form Package
Edit page
IntroductionInstallationFormSimple FormButtonFieldBasic UsagePropsFieldWrapperRadioGroupSelectForm ValidationStateonFocus onChange onBlurState ManipulationCustom Error MessagesFeedback on disabled ButtonStylingDynamic FieldsDynamic Fields 2Dynamic Fields 3Bind Input FieldsBind Input Fields 2Third Party ComponentsFile UploadWhy

Field

This component has to be a child within the <Form /> component. This component handles its own state and on any state change it will report it to the <Form /> component which validates the whole form.

Basic Usage

import {
Form,
Field,
} from 'react-form-package';

Render a <Form /> with an email <Field /> and a <Button /> component.

Email

Props

Property TypeRequiredDefaultDescription
id Stringtrue
typeStringtruecheckbox, date, textarea, datetime-local, email, number, tel, text, password, time, url, file
requiredBoolfalsefalse
minString (digit or date (YYYY-MM-DD))falsetext, textarea, password: has to have at least min characters; number, date: has to be at least min
maxString (digit or date (YYYY-MM-DD))falsetext, textarea, password: has to have at least min characters; number, date: has to be at least min
matchRegExfalsethe input value has to match the regular expression
sameAsString the input value has to have the same value as the input field with the id specified in sameAs
preOnChangeFunc false manipulate the state before its validated (see State Manipulation)
errorMessageStringfalsedefine your own custom error message for the input
onFocusFuncfalseget access to the state of the form when the user focus on the input
onChangeFuncfalseget access to the state of the form when the user changes the input
onBlurFuncfalseget access to the state of the form when the user blurs the input
dynamicBoolfalseonly needed for dynamically added fields
fieldObjectfalse only needed for dynamically added fields. This object holds at least id, type, and may hold min, max, required
bintToString, Arrayfalse  only needed for binding input fields. The id/ids of the input/inputs you want to manipulate
bintToAllwaysBoolfalse  only needed for binding input fields. Only needed if you want that the bindToCallback is triggered even the bound input field was already touched (blurred)
bindToCallbackFuncfalseonly needed for binding input fields. The callback to set the target's (bindTo) input value, which gets called onChange (return a single value or an array of values)