Remix Validated Form

() => FormContext

Returns the value of the form context. This is usually not necessary, but can be useful in some situations.

FormContext

Record<string, string>

Contains all the validation errors in the form. The keys of the object are the field names and values are the error messages. If the form contains nested data, the field errors are not nested -- the keys of the object will be the same as the name passed to the input itself. (e.g. todos[1].title)

boolean

Whether or not the form valid.

(...fieldNames: string[]) => void

Clear the errors from all the specified fields.

(fieldName: string) => void

Performs validation on the specified field and populates fieldErrors if there is an error.

string | undefined

The value of the action prop passed to the ValidatedForm component. If no action prop is passed, this will be undefined.

boolean

Whether or not the form is currently submitting.

boolean

Whether or not a submit has been attempted. This will be true after the first submit attempt, even if the form is invalid. This resets when the form resets.

Record<string, any>

The default values of the ValidatedForm component. In cases where the user has javascript disabled, this can sometimes be something other than what is passed into the ValidatedForm directly.

Record<string, boolean>

Contains all the touched fields. The keys of the object are the field names and values are whether or not the field has been touched. If a field has not been touched at all, the value will be undefined. If you set touched to false manually, then the value will be false.

(fieldName: string, touched: boolean) => void

Manually set the touched state of the specified field.