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 />
     function fetchselectedvalue(){
                var myExternalEvent;
                myExternalEvent = $A.get("e.c:GetAddressInfos");
                myExternalEvent.setParams({"CityValue": document.getElementById('{!$Component.CityValue}').value});

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

1 Answer 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.

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.