function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
Enter a number: <ui:inputNumber aura:id="inputCmp"/> <br/> <lightning:button label="Submit" onclick="{!c.doAction}"/>
/*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); } } }
Hi
you can also validate based on different events
eg:keydown,kepup,button events,onblur etc.
for example:-
<input aura:id="min" id="min" class=" slds-input" onkeydown="{!c.numberCheck}" type="text" name="input1" placeholder="min" label="Enter a Min value" /> onkeydown="{!c.numberCheck}" numberCheck: function(component, event, helper){ if((event.keyCode>=48 && event.keyCode<=57 ) || event.keyCode==08){ }else{ event.preventDefault(); } }
In the above , i am restricting the user to input only what i require.
similarly the same method or modified on can be used in all the events to have validation in lightning component level.
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/js_validate_fields.htm
Hi
you can also validate based on different events
eg:keydown,kepup,button events,onblur etc.
for example:-
In the above , i am restricting the user to input only what i require.
similarly the same method or modified on can be used in all the events to have validation in lightning component level.