I have a master lightning-component with a next button and a child component button with create. I want to a replace the create button from the child with the next button from the parent. I get the error: Uncaught Action failed: c:ModalWizard$controller$moveNext [Cannot read property 'next' of undefined]

I tried on component parent:

 <lightning:button variant="brand" label="Next" title="Next" onclick="{! c.moveNext }"/>

Controller parent:

 moveNext : function(component,event,helper){
     // control the next button based on 'currentStep' attribute value    
        var getCurrentStep = component.get("v.currentStep");
        if(getCurrentStep == "1"){
            component.set("v.currentStep", "2");
        else if(getCurrentStep == 2){
            var objFieldsetGenerator = component.find('FieldsetGenerator');
            component.set("v.currentStep", "3");

Child component on parent:

<c:FieldsetGenerator genericObject="{!v.genericObject}" fieldSetName="{!v.fieldset}"  title="Yo" mode="Input"/>

Childobject FieldsetGenerator:

            <aura:if isTrue="{!v.mode=='Input'? true: false}">
                <lightning:button class="slds-m-top_small" variant="brand"
                                  type="submit" name="update" 
                                  label="{!empty(v.recordId)?'Create':'Update'}" />


  next: function(component, event, helper) {
  var recordId = component.get("v.recordId");
        action.setCallback(this, function(a) {
            var fields = a.getReturnValue();
            component.set("v.fields", fields);
  • Did you declare an aura method inside your child component? – Martin Lezer Jul 15 '19 at 13:20
  • I did as follows: <aura:method name="FieldsetGenerator" action="{!c.next}" /> – Thomas Jul 15 '19 at 14:45

i am not finding aura:id declaration for child component(c:FieldsetGenerator) in your parent component code any where.

you child component declaration in parent component should be like below.

 <c:FieldsetGenerator aura:id ='FieldsetGenerator' genericObject="{!v.genericObject}" fieldSetName="{!v.fieldset}"  title="Yo" mode="Input"/>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.