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
deepak kumawatdeepak kumawat 

Salesforce Lightning

"WARNING: Callback failed: aura://ComponentController/ACTION$getApplication"

What is solution, plz asap reply ...


Comp.

<aura:component >
    <aura:attribute name="list" type="String[]" default="Item 1, Item 2, Item 3"/>
    <aura:attribute name="selected" type="String[]"/>
    
    
    
    
    <aura:iteration items="{!v.list}" var="l">
        <ui:inputRadio name="qwer" label="{!l}" change="{!c.select}" />
    </aura:iteration>
    
    ..................... <ui:outputText value="{!v.selected}"/>
     
    
</aura:component>

Lightning controller..


({
    select : function(component, event, helper) {
        var src = event.getSource();
        var name = src.get("v.value");
         .........console.log(name);
        component.set("v.selected", name);
    }
})



App  


<aura:application access="GLOBAL" extends="ltng:outApp">
    <aura:dependency resource="SFAuraCMP:Light121"/>
</aura:application>
 

Thanks,
Deepak

Best Answer chosen by deepak kumawat
Amit VaidyaAmit Vaidya
Hi Deepak,

I have updated the code. Just updates the names of Component and App as below:
 
VF Page:

<apex:page standardStylesheets="false" showHeader="false" sidebar="false">
   
    <apex:includeScript value="/lightning/lightning.out.js" />
    <div id="lightning" />

    <script>
        $Lightning.use("c:TryandErrorApp", function() {
          $Lightning.createComponent(
            "c:TryandError",
            {},
            "lightning",
            function(cmp) {
                // do some stuff
                console.log("Component created!");
                console.log(cmp);
            });
        });
    </script>

</apex:page>

Lightning Component:
//TryandError.cmp
<aura:component >
    <aura:attribute name="list" type="String[]" default="Item 1, Item 2, Item 3"/>
    <aura:attribute name="selected" type="String"/>

    <aura:iteration items="{!v.list}" var="l">
        <ui:inputRadio name="qwer" label="{!l}" change="{!c.select}" />
    </aura:iteration>
    
    <ui:outputText value="{!v.selected}"/>
</aura:component>

Controller:
//TryandErrorController.js
({
    select : function(component, event, helper) {
        var src = event.getSource();
        var name = src.get("v.label");
        console.log(name);
        component.set("v.selected", name);
    }
})

Application:
//TryandErrorApp.app
<aura:application access="GLOBAL" extends="ltng:outApp">
    <aura:dependency resource="c:TryandError"/>
</aura:application>

It is working for me. Please try and verify.

Thanks,
Amit

All Answers

Amit VaidyaAmit Vaidya
Hi Deepak,

Can you provide the content of SFAuraCMP:Light121 as well?
deepak kumawatdeepak kumawat
Yes ,

Actually in  above part  me also included this component's content 



<aura:component >
    <aura:attribute name="list" type="String[]" default="Item 1, Item 2, Item 3"/>
    <aura:attribute name="selected" type="String[]"/>
    
    
    
    
    <aura:iteration items="{!v.list}" var="l">
        <ui:inputRadio name="qwer" label="{!l}" change="{!c.select}" />
    </aura:iteration>
    
    ..................... <ui:outputText value="{!v.selected}"/>
     
    
</aura:component>



And This vf page, where i inclueeded this app



<apex:page standardStylesheets="false" showHeader="false" sidebar="false">
   
    <!-- Include a JavaScript file in your Visualforce page -->
    <apex:includeScript value="/lightning/lightning.out.js" />

    <div id="lightning" />

    <script>
    //Tell your Visualforce page to use ExposeVF Lightning app
        $Lightning.use("SFAuraCMP:Light121App", function() {
            // Write a function that creates the component on the page
          $Lightning.createComponent("SFAuraCMP:Light121",
          {},
          "lightning",
          function(cmp) {
            // do some stuff
          });
        });
    </script>

</apex:page>
deepak kumawatdeepak kumawat
pls find the attached content

thanks 
Deepak 
 
Amit VaidyaAmit Vaidya
Hi Deepak,

I have updated the code. Just updates the names of Component and App as below:
 
VF Page:

<apex:page standardStylesheets="false" showHeader="false" sidebar="false">
   
    <apex:includeScript value="/lightning/lightning.out.js" />
    <div id="lightning" />

    <script>
        $Lightning.use("c:TryandErrorApp", function() {
          $Lightning.createComponent(
            "c:TryandError",
            {},
            "lightning",
            function(cmp) {
                // do some stuff
                console.log("Component created!");
                console.log(cmp);
            });
        });
    </script>

</apex:page>

Lightning Component:
//TryandError.cmp
<aura:component >
    <aura:attribute name="list" type="String[]" default="Item 1, Item 2, Item 3"/>
    <aura:attribute name="selected" type="String"/>

    <aura:iteration items="{!v.list}" var="l">
        <ui:inputRadio name="qwer" label="{!l}" change="{!c.select}" />
    </aura:iteration>
    
    <ui:outputText value="{!v.selected}"/>
</aura:component>

Controller:
//TryandErrorController.js
({
    select : function(component, event, helper) {
        var src = event.getSource();
        var name = src.get("v.label");
        console.log(name);
        component.set("v.selected", name);
    }
})

Application:
//TryandErrorApp.app
<aura:application access="GLOBAL" extends="ltng:outApp">
    <aura:dependency resource="c:TryandError"/>
</aura:application>

It is working for me. Please try and verify.

Thanks,
Amit
This was selected as the best answer
deepak kumawatdeepak kumawat
Fine, it is working ,
Thanks
But I have one question that is why is not working this 

:: - var elem = evt.getSource().getElement();
     var selected = elem.textContent;

Thanks 
Deepak(Deny)
deepak kumawatdeepak kumawat
B/Z of before 3 days,  it was working fine.

Like:

1. https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/aura_compref_ui_inputRadio.htm
2. http://salesforce.stackexchange.com/questions/73476/lightning-aura-components-access-to-the-component-attributes
Amit VaidyaAmit Vaidya
Hi Deepak,

Looks like the code provided in the guide itself also not supporting getElement function of Javascript. So, they might not removed the support for that function. Lets see if anyone from forum comes with any conclunsion.

Thanks,
Amit
Amit VaidyaAmit Vaidya
Hi Deepak,

Just came to know about your above issue from Srinivasa Somu that you needs to turn off Enable Lightning LockerService Security in Critical Updates. This update supporting only the JS supported functions specified in the https://<yourDomain>.lightning.force.com/auradocs/reference.app

Thanks,
Amit