You need to sign in to do that
Don't have an account?
Rama_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....
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....
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
compEvent.setParams({
"valuesetone" :selectedpicklistvalue,
"valuesettwo" :'test1',
"valuesetthree" :'test1',
"valuesetfour" :'test1',
});
No luck , getting same error :(
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
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);
});
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