The isChecked
validator will display a warning if the user has selected the checkbox &
then deselected it. This requires a boolean type to be set in your state, see below.
This validator doesn't require any arguments to be passed in.
This validator doesn't require any arguments to be passed in.
The isFieldEmpty
validator performs a comparison against minLength
& the field element
value. If they are equal or the minLength
is greater than the form element value then
this element is not valid & a message is displayed.
This validator will display the warning if a user has selected a file but then reselected nothing (by clicking the cancel button in the file popup window). This validator doesn't require any arguments to be passed in.
To use the isRadioChecked
, select the RadioField
component you wish the user to select
& add the validator function to the validators
prop. This will now display a warning if
the user has deselected the required option. This validator doesn't
require any arguments to be passed in.
To use the isValidDate pass in an array containing either a from or to date string OR both OR none.
Function that takes a callback which contains the callers own validation logic & returns an array of string(s) which are the validation error message or undefined. Below is an example of creating a custom validator to test if a field has a string length of nth.
There are 3 arguments available to your custom validation callback:
Helper function to get correct state from the context object within a validator:
Generated using TypeDoc
The
passwordKey
is normally the first password form field the user fills in before then confirming that the password is correct with a confirm password field. this validator check that both password fields are equal or else will return an error message and set this field to invalid.`<PasswordField // other props... name="myPassword" /> <ConfirmPasswordField // other props... validators={[areFieldsEqual("myPassword")]} /> // message: Fields do not match
The name of the password form element you watch to match against