Posts

Showing posts from October, 2019

Lightning Validation with Custom Message : Aura vs LWC

Image
Lightning Validation : Aura Component LightningValidation.cmp (Component) Fill Information LightningValidation.js (JS Controller ) ({ handleValidation : function(cmp) { var allValid = cmp.find('validfield').reduce(function (validSoFar, inputCmp) { inputCmp.reportValidity(); return validSoFar && inputCmp.checkValidity(); }, true); if (allValid) { //Submit information on Server } else { alert('Please fill required and update all invalid form entries'); } }, handleCustomValidation : function(cmp,event) { var inputValue = event.getSource().get("v.value"); // is input valid text? if (inputValue.indexOf('@')>=0) { inputCmp.setCustomValidity("Please Don't include '@' in name"); } else { input...