function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rama_SFDCRama_SFDC 

How to pass <lightning:select > and <lightning:input > values from child component to parent component

Hi All ,
How to pass <lightning:select > and <lightning:input > values from child component to parent component 
i'm preparing the data on child component (user UI from with mutiple rows) and i have save button on parent component , when i'm click on save button  all the input field values need to bring from child component to parent ,i'm using component event but values are not getting....
md saif ansarimd saif ansari
Share your code here so I can check where you are getting error. 
Rama_SFDCRama_SFDC
Getting below error message when onchange event called 
This page has an error. You might just need to refresh it. Unable to find 'gettingvalues' on 'compound://c.searchcomp.
How to row values to parent component from child ?

<lightning:select aura:id="selectedlistId" name="Test" onchange="{!c.handleControllingfield}" value="{!v.selectedValue}" >
                <option>--None--</option>
                <aura:iteration items="{!v.valueslist}" var="item">
                    <option value="{!item}" text="{!item}" selected="{!item.selected}"/>
                </aura:iteration>
            </lightning:select>
            
               
        js controller :    
        handleControllingfield : function(component, event, helper) {
        var selectedpicklistvalue = component.find("selectedlistId").get("v.value"); 
        var compEvent = component.getEvent("Fieldvalues");
       
        compEvent.setParams({
            "valuesetone" :selectedpicklistvalue,
            "valuesettwo" :'test1',
            "valuesetthree" :'test1',
            "valuesetfour" :'test1',
        });
        compEvent.fire();
        
        if(selectedpicklistvalue!=''&& selectedpicklistvalue!=null && selectedpicklistvalue !="--None--"){
           
            var action = component.get("c.getpickvalues");
            action.setParams({
                "strpickvalues" : selectedpicklistvalue 
            });
             
            action.setCallback(this, function(response) {
                var state = response.getState();
                if (state === "SUCCESS") {      
                    component.set("v.isDependentDisable" ,false);
                    component.set("v.assaygropinglist",response.getReturnValue()); 
                    
                }   
            });
            
            $A.enqueueAction(action);
        }
        else {
            component.set("v.isDependentDisable" ,true);
        }
    }

Thanks in Advance
Naveen IlaNaveen Ila
Can you save file by removing comma "," from highlited one and try again. 

compEvent.setParams({
            "valuesetone" :selectedpicklistvalue,
            "valuesettwo" :'test1',
            "valuesetthree" :'test1',
            "valuesetfour" :'test1',
        });


 
Rama_SFDCRama_SFDC
Thanks Naveen 
No luck , getting same error  :(
thatheraherethatherahere
Hi Ramakrishna,

Could you please share code for you parent component as well. As the error message saying "Unable to find 'gettingvalues' on 'compound://c.searchcomp." I doubt from the parent component. Also better If you can put your code here for event registration and event handling.

Regards,
Govind Thathera
Rama_SFDCRama_SFDC
Hi Govind ,

parent component  save method 
Save: function(component, event, helper) {
        
         var strval = event.getParam("valuesetone");
           alert('insidesave'+strval );

        var action = component.get("c.savemarketshare");
        action.setParams({
            "ListContact": component.get("v.contactList"),
            "straccountid": component.get("v.AccountID")
        });
        // set call back 
        action.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                alert('status'+state) ;
            }
            else{
                alert('fail'+state);
            }
$A.enqueueAction(action);
        });
thatheraherethatherahere
Hi RamaKrishna,

It doesn't help. Are you getting "alert('insidesave'+strval );" on execution of your event? It looks like the error message you posted above is not coming from this method. 

I would like to see how did you register your event and its handler. I mean the values you are putting into <aura:registerEvent> and <aura:handler> components.

Also possible please add a screenshot of error message you are getting.

Regards,
Govind Thathera