<div>
- *errorHandlingController.js*/
- {
- doAction : function(component) {
- var inputCmp = component.find("inputCmp");
- var value = inputCmp.get("v.value");
-
- // Is input numeric?
- if (isNaN(value)) {
- // Set error
- inputCmp.set("v.errors", [{message:"Input not a number: " + value}]);
- } else {
- // Clear error
- inputCmp.set("v.errors", null);
- }
- }
- }
<button data-clipboard-text=”/*errorHandlingController.js*/ { doAction : function(component) { var inputCmp = component.find("inputCmp"); var value = inputCmp.get("v.value"); // Is input numeric? if (isNaN(value)) { // Set error inputCmp.set("v.errors", [{message:"Input not a number: " + value}]); } else { // Clear error inputCmp.set("v.errors", null); } } } “></button>
When you enter a value and click Submit, <samp>doAction</samp> in the contro
</div>