Form status | Mantine

Get fields and form touched, dirty and submitting statuses

form.isTouched and form.isDirty fields provide information about the current field status:

The touchTrigger option allows customizing events that change the touched state. It accepts two options:

Example of using focus trigger:

You can provide initial touched and dirty values with the initialTouched and initialDirty properties. Both properties support the same field path format as errors :

The form.resetTouched and form.resetDirty functions will make all fields clean and untouched. Note that form.reset will also reset the touched and dirty state:

To reset the values that are used for the dirty check, call form.resetDirty with new values:

The form.submitting field will be set to true if the function passed to form.onSubmit returns a promise. After the promise is resolved or rejected, form.submitting will be set to false :

You can also manually set form.submitting to true or false :

The form.validating property is true while any async validation is in progress. This applies to form.validate() , form.validateField() , form.isValid() , and the validation triggered by form.onSubmit .

form.isValidating(path) returns true if a specific field is currently being validated. When form.validate() or form.onSubmit runs all rules, every field with a rule is considered validating. When form.validateField(path) is called, only the targeted field is considered validating.

Recommended articles