Skip to content

Model Object

clearErrors()

clearErrors() — returns void

Available in: model Category: Error Functions

Clears all validation or manual errors stored on a model object. You can clear all errors, or target specific errors either by property name or by a custom error name. This is useful when resetting an object’s state before re-validation, updating values programmatically, or handling conditional validation logic.

NameTypeRequiredDefaultDescription
propertystringnoSpecify a property name here if you want to clear all errors set on that property.
namestringnoSpecify an error name here if you want to clear all errors set with that error name.
1. Clear all errors on the object
// Remove all errors regardless of property
this.clearErrors();

2. Clear errors on a specific property
// Remove all errors associated with the 'firstName' property
this.clearErrors(property="firstName");

3. Clear a specific error by name
// Remove only the error named 'emailFormatError' without affecting other errors
this.clearErrors(name="emailFormatError");