4

If I have a visualforce page embedded in a lightning component. How can I fire a lightning event in the visualforce page and then handle it in the lightning component?

In my Visualforce page i already included this function:

<apex:includeLightning />
<script>
     function fetchselectedvalue(){
                var myExternalEvent;
                myExternalEvent = $A.get("e.c:GetAddressInfos");
                myExternalEvent.setParams({"CityValue": document.getElementById('{!$Component.CityValue}').value});
                myExternalEvent.fire();
        }
</script>

Where GetAddressInfos is the name of my event. But it's not working.

1 Answer 1

1
  • Create a Lightning Component that wraps your VF page
  • Use postMessage() to send a message from the VF page to the Lightning Component
  • In the message handler of your wrapper component, create and fire your application event

See this blog post for details.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .