Skip to main content

I am using lightning:combobox seems like required doesn't work, can someone please help me with the code. How can I make this lightning:combobox field required by throwing some validation using client side controller in Lightning Aura

 

#Aura Component  #Aura  #Aura Lightning Components  #Lightning Aura  #Lightning Aura Component

4 Antworten
  1. 2. Sept. 2021, 06:38

    When I pressed the submit button, I was launching handleChange2 with validity2 set to true on the parent component using this custom component.

     

    the custom component that includes lightning: combobox.

     

    cmp

    <aura:attribute name="validity2" type="Boolean" default="false"/> 

    <aura:handler name="change" value="{!v.validity2}" action="{!c.handleChange2}"/>

     

    controller

    handleChange2 : function(component, event, helper) {

            var inputCmp = component.find("required_ck");//Aura: id for lightning: combobox

            inputCmp.showHelpMessageIfInvalid();

     },

0/9000