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
Mridula AnuragMridula Anurag 

Lightning component not working in IE11

Hi,

I have  created a lightning component and added it to console using App Builder. When I open the app -( eg:PN console) it will land on home page .I have one more tab named PN on click of New ,its lands on strange error whcih says " Error in $A.getCallback() [Syntax error]
Callback failed: aura://ComponentController/ACTION$getComponent
Callback failed: aura://ComponentController/ACTION$getComponent"

I am not able to find out from where this error is coming.I do not have component with this name as well.As I am new to lightning ,could you please let me know what can be the reason.I have read an article that there is an option to opt in for IE 11 Extended support under Session settings.I have done that as well.Still it does not works.

Thanks,
MridulaError screen
Meghna Vijay 7Meghna Vijay 7
Hi,
Can you post js code of the lightning component?
Thanks
Mridula AnuragMridula Anurag
Hi Meghna,

Please find the controller part of my component

({
    
    doInit : function(component, event, helper) {
        
        console.log('code started***');
        var action = component.get("c.getPiklistValues");
        action.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS"){
                var result = response.getReturnValue();
                console.log('result**'+result);
                var plValues = [];
                for (var i = 0; i < result.length; i++) {
                    plValues.push({
                        label: result[i],
                        value: result[i]
                    });
                }
                component.set("v.swList", plValues);
            } 
        }); 
        
        $A.enqueueAction(action);
        $A.enqueueAction(component.get('c.myAction')); 
    },
    myAction : function(component, event, helper) {
        
        var optionValue = component.get("c.getTasks");
        optionValue.setCallback(this, function(a) {
            
            component.set("v.optVal",a.getReturnValue());
        });
        $A.enqueueAction(optionValue);
    },
    toggleTasks: function (component,event,helper){
        var sel = component.find("mySelect");
        var nav =    sel.get("v.value");
        console.log('inside***'+nav);
        component.set("v.selectedTaskPicklist",nav);
        if (nav == "Other") {     
            component.set("v.toggleOthrs", true);
        }else{
            component.set("v.toggleOthrs", false);
        }
    },
    handleSWChange: function (component, event, helper) {
        //Get the Selected values   
        debugger;
        var selectedValues = event.getParam("value");
        
        //Update the Selected Values  
        component.set("v.selectedSWList", selectedValues);
    },
    onPicklistChange:function(component, event, helper) {
        // Initialize input select options
        
        var dynamicCmp = component.find("processDescriptions");
        var resultCmp = component.find("processDescriptions");
        resultCmp.set("v.value", dynamicCmp.get("v.value"));
    },
    /*call dateUpdate function on onchange event on date field*/ 
    dateUpdate : function(component, event, helper) {
        
        var today = new Date();        
        var dd = today.getDate();
        var mm = today.getMonth() + 1; //January is 0!
        var yyyy = today.getFullYear();
        
        if(dd < 10){
            dd = '0' + dd;
        } 
        
        if(mm < 10){
            mm = '0' + mm;
        }
        
        var todayFormattedDate = yyyy+'-'+mm+'-'+dd;
        if(component.get("v.product.LHF_Scheduled_Start_Date__c") != '' && component.get("v.product.LHF_Scheduled_Start_Date__c") < todayFormattedDate){
            component.set("v.dateValidationError" , true);
        }else{
            
            component.set("v.dateValidationError" , false);
        }
    },
    /* Product Information record creation*/
    createProduct : function(component, event, helper) {
        var inputCmp = component.find("fieldToValidate");
        var value = inputCmp.get("v.value");
        if (value === ''||value == null ) {
            inputCmp.setCustomValidity('Product Name is mandatory');
        }else {
            inputCmp.setCustomValidity(''); 
            helper.createPIS(component, event, helper);
        }
        /*var allValid = component.find('fieldToValidate').reduce(function (validSoFar, inputCmp) {
            inputCmp.showHelpMessageIfInvalid();
            return validSoFar && !inputCmp.get('v.validity').valid;
        }, true);
        var isDateError = component.get("v.dateValidationError");
        if(allValid && isDateError!=true && blank==0 ) {
            helper.createPIS(component, event, helper);
        }*/
    },
    /*Popup component -Process */
    
    showModal : function(component, event, helper) {
        debugger;
        component.set("v.isOpen" , true);     },
    showModalGHS : function(component, event, helper) {
        debugger;
        component.set("v.isGHSOpen" , true); },
    closeModal : function(component, event, helper) {
        component.set("v.isOpen" , false); 
        $A.enqueueAction(component.get('c.loadJquery'));
    },
    closeModalGHS : function(component, event, helper) {
        component.set("v.isGHSOpen" , false); 
    },
    addGHS : function(component, event, helper) {
        debugger;
        var inputCmp = component.find("chToValidate");
        var inputCmp1 =component.find("qaToValidate");
        var value = inputCmp.get("v.value");
        var value2 = inputCmp1.get("v.value");
        if (value === ''||value == null ) {
            inputCmp.setCustomValidity('Chemical Name is mandatory');
        } else if(value2 === '' || value2 ==null){
            inputCmp1.setCustomValidity('QA/LY Number is mandatory');
        }else {
            inputCmp.setCustomValidity(''); 
            inputCmp1.setCustomValidity('');
            helper.createGHS(component, event, helper);
        }
        inputCmp.reportValidity(); 
        
    },
    
    addProcess : function(component, event, helper) {
        debugger;
        if(component.get('v.selectedTaskPicklist')=='Other'){
            var inputCmp = component.find("taskToValidate");
            var value = inputCmp.get("v.value");
            // is input valid text?
            if (value === ''||value == null ) {
                inputCmp.setCustomValidity('Task is mandatory');
            } else {
                inputCmp.setCustomValidity(''); 
                helper.createTasks(component, event, helper);
            }
            inputCmp.reportValidity(); 
        }else{
            helper.createTasks(component, event, helper);
        }
    },
    removeProcess :function(component, event, helper){
        
        helper.removeTasks(component, event, helper);
        
    },
    removeGHSEntry :function(component, event, helper){
        
        helper.removeGHS(component, event, helper);
        
    },
    
    /* validate the product details*/
    validateProduct : function(component, event, helper) {
        var allValid = component.find('fieldToValidate').reduce(function (validSoFar, inputCmp) {
            inputCmp.showHelpMessageIfInvalid();
            return validSoFar && !inputCmp.get('v.validity').valueMissing;
        }, true);
        return allValid;
    },
    /* validate the product details*/
    validateGHS : function(component, event, helper) {
        var allValid = component.find('ghsToValidate').reduce(function (validSoFar, inputCmp) {
            inputCmp.showHelpMessageIfInvalid();
            return validSoFar && inputCmp.get('v.validity').valid;
        }, true);
        return allValid;
    },
    validateTask : function(component, event, helper) {
        debugger;
        var allValid = component.find('taskToValidate').reduce(function (validSoFar, inputCmp) {
            inputCmp.showHelpMessageIfInvalid();
            return validSoFar && inputCmp.get('v.validity').valid;
        }, true);
        return allValid; 
    },
    editOption :function(component,event,helper){
        debugger;
        /* var currentTarget = event.currentTarget;
       var itemEdit = currentTarget.getAttribute("value"); // Get the target object
        console.log('ITEMEDIT'+itemEdit);
       component.set('v.ghsInfo', itemEdit);
       component.set("v.isOpen" , true);*/
        
        var index = event.currentTarget.getAttribute("data-index");
        var ghsVal = component.get("v.ghsList");
        console.log(ghsVal+'&&&&&&&&'+ghsVal[index]);
        component.set("v.oldValue",ghsVal[index]);
        component.set("v.indexPos",parseInt(index));
        component.set("v.isGHSOpen" , true);
    },
    /*upload attachments*/
    
    handleUploadFinished :function(component,event,helper){
        //component.saveAttachment(component,event,helper);
        console.log('Upload file started');
        debugger;
        var fileName ='';
        var uploadedFiles = event.getParam("files");
        console.log('uploadedFiles'+uploadedFiles);
        component.set("v.attachment",uploadedFiles);
        for(var i in uploadedFiles){
            fileName = fileName +','+uploadedFiles[i].name;
        }
        var toastEvent = $A.get("e.force:showToast");
        toastEvent.setParams({
            "title": "Success!",
            "message": "Files "+fileName+" Uploaded successfully."
        });
        toastEvent.fire();
    },
    sectionOne : function(component, event, helper) {
        helper.helperFun(component,event,'articleOne');
    },
    sectionTwo : function(component, event, helper) {
        helper.helperFun(component,event,'articleTwo');
    },
    sectionThree : function(component, event, helper) {
        helper.helperFun(component,event,'articleThree');
    },
    sectionFour : function(component, event, helper) {
        helper.helperFun(component,event,'articleFour');
    },
    sectionFive : function(component, event, helper) {
        helper.helperFun(component,event,'articleFive');
    },
    allowDrop: function(component, event, helper) {
        event.preventDefault();
    },
    
    drag: function (component, event, helper) {
        event.dataTransfer.setData("text", event.target.id);
    },
    
    drop: function (component, event, helper) {
        
        var data = event.dataTransfer.getData("text");
        console.log('DATA&&&&&&'+data);
        // Find the record ID by crawling up the DOM hierarchy
        var tar = event.target.closest('[id]');
        console.log(tar);
        var processData = component.get("v.processList");
        var index1, index2, temp;
        // Find the index of each item to move
        processData.forEach((v,i)=>{if(v.Id===data) index1 = i; if(v.Id===tar.id) index2 = i;});
        console.log('index 1*****'+index1+'&&&&&&&&&&'+index2);
        if(index1<index2) {
            // Lower index to higher index; we move the lower index first, then remove it.
            processData.splice(index2+1, 0, processData
                               .records[index1]);
            processData.splice(index1, 1);
        } else {
            // Higher index to lower index; we remove the higher index, then add it to the lower index.
            temp = processData.splice(index1, 1)[0];
            processData.splice(index2, 0, temp);
        }
        // Trigger aura:valueChange, component will rerender
        component.set("v.processList", processData);
        event.preventDefault();
    }

        
})



Thanks,
Mridula
Meghna Vijay 7Meghna Vijay 7
On click of New button which controller action fires?
 
Mridula AnuragMridula Anurag
Hi Meghna,

 I have overide the standard New button with Lightning component.On load of the page it will call the init function.  The IE 11 issue is fixed now.It was because ,there are 3 methods being wriiten for drag and drop functionality for some reason i am not calling that function in component. But in IE ,it was throwing the error.Not sure why it is giving the error eventhough it is not being called .Any way it is fixed.Thanks for the help.

Thanks,
Mridula