• Rishabh Rathore 11
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Here's my component code:

<aura:component implements="force:lightningQuickAction,force:hasRecordId" access="global"  >
<ui:inputText aura:id="PlanName" label="Plan Name" required="true" change="{!c.onChange}"/>   
<ui:inputnumber aura:id="Amount" label="Amount" required="true" change="{!c.onChange}" />
<lightning:button label="Add New Card"   aura:id="newcard"    onclick="{!c.chargefun}"  />  
</aura:component >
   
component.js code :

({
 onChange : function(component, event, helper)
    {        
            var selectCmp = event.getSource();
          selectCmp.set("v.errors",null);
    },

chargefun : function(component,event,helper)
{
  var PlanName = component.find("PlanName").get("v.value");
  var amt = component.find("Amount");
  var amount = amt.get("v.value");
   if($A.util.isEmpty(amount) ||  $A.util.isEmpty(PlanName ))
   {
       if ($A.util.isEmpty(amount))
           {
             amt.set("v.errors", [{message:"Please Enter Value"}]);
           }
           if ($A.util.isEmpty(PlanName))
           {
             component.find("PlanName").set("v.errors", [{message:"Please Enter Value..."}]);
           }
   },

})


In above code,  event.getSource() was not working for <ui:inputnumber>. So iam not able to remove error message.