Newer Version Available

This content describes an older version of this product. View Latest

ui:clearErrors

Indicates that any validation errors should be cleared.

To set a handler for the ui:clearErrors event, use the onClearErrors system attribute on a component that extends ui:input, such as ui:inputNumber.

The following ui:inputNumber component handles an error when the ui:button component is pressed. You can fire and handle these events in a client-side controller.
1<aura:component>
2    Enter a number: 
3    <!-- onError calls your client-side controller to handle a validation error -->
4    <!-- onClearErrors calls your client-side controller to handle clearing of errors -->
5    <ui:inputNumber aura:id="inputCmp" onError="{!c.handleError}" onClearErrors="{!c.handleClearError}"/> <br/>
6
7    <!-- press calls your client-side controller to trigger validation errors -->
8    <ui:button label="Submit" press="{!c.doAction}"/>
9</aura:component>
For more information, see Validating Fields.