I’m facing an issue registering tabset’s ‘onselect’ and textArea’s ‘onblur’ event when doing a ‘save’ on them. Below is my situation

  1. I created a form using lightning component which consists of a tabset with multiple tabs in it and each tab has various kinds of fields on them.

  2. Whenever user changes tab, we need to save the data. I achieved this by calling the Save method in my client side controller on 'onchange' of the tabSet. This is working fine. Whenever user changes tab, save method is called, record is saved and tab changes.

            <lightning:tabset aura:id="mainTabSet" variant="default" class="slds-tabs_small"
                                      selectedTabId = "{!v.mainTabSelectedId}" onselect="{! c.saveForm }">

3.Then, users also want the form to be saved when some of the textareas on the tabs are changed. I achieved this by calling the same save method on 'onblur' of the text area. This is also working fine.

            <lightning:textarea aura:id = "comments" class="slds-p-around_x-small" label="Comments"

 variant="standard" value = "{!v.record.Comments_c}"

                                                                    onblur="{! c. saveForm }"/>
  1. This is how my save method in JS controller looks like

saveForm: function(component, event, helper)


    var action = component.get("c.saveContForm");


                            ****set parameters*****



        var status = response.getState();

        if(status == "SUCCESS")


            var returnValue = response.getReturnValue();

            component.set("v.formRecord", returnValue );

            component.set("v.errorMsg", '' );

        }else if(status == "ERROR")


          ***** compile errors to display on form*******



  1. But, I'm facing the issue in one particular scenario. When user updates one of the Text Areas in Step 3 and immediately click on a different tab, record is saving but it is not navigating to the new tab. This happens on a random basis. Sometimes, it does navigate to the new tab and sometimes it does not.

  2. I did some UI debugging and found this. Whenever text area is changed and user clicks on a different tab, 'onblur' is triggered first and 'Save' method is called and record is saved. When this cycle completes, the event of tab click is lost. So, system thinks that tab is not changed and remains on the same tab.

Any suggestions or directions to resolve this is highly appreciated.

Your Answer

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

Browse other questions tagged or ask your own question.