Skip to main content
added 439 characters in body
Source Link
sfdcfox
  • 501.7k
  • 21
  • 473
  • 828

You need to fire an event at your component. I don't have time to actually test this, but something like the following should work:

<!-- Visualforce snippet -->

<script>
function sendDataToLightning(el) {
  var evt = ($A || window.opener.$A).get("e.c:updateComponentValue");
  evt.setParams( { value: el.value } );
  evt.fireEvent();
}
</script>
<input type="text" onchange="sendDataToLightning(this);" />

<!-- Lightning component snippet -->

<aura:handler event="c:updateComponentValue" action="{!c.updateValue}" />

Note that what I'm implying is that you must communicate across the Visualforce/Lightning barrier via events. You can listen for Lightning Events in Visualforce, and you can listen for Lightning Events initiated outside of Lightning to update your component's state. See Firing Lightning Events from Non-Lightning Code as an example.

You need to fire an event at your component. I don't have time to actually test this, but something like the following should work:

<!-- Visualforce snippet -->

<script>
function sendDataToLightning(el) {
  var evt = $A.get("e.c:updateComponentValue");
  evt.setParams( { value: el.value } );
  evt.fireEvent();
}
</script>
<input type="text" onchange="sendDataToLightning(this);" />

<!-- Lightning component snippet -->

<aura:handler event="c:updateComponentValue" action="{!c.updateValue}" />

You need to fire an event at your component. I don't have time to actually test this, but something like the following should work:

<!-- Visualforce snippet -->

<script>
function sendDataToLightning(el) {
  var evt = ($A || window.opener.$A).get("e.c:updateComponentValue");
  evt.setParams( { value: el.value } );
  evt.fireEvent();
}
</script>
<input type="text" onchange="sendDataToLightning(this);" />

<!-- Lightning component snippet -->

<aura:handler event="c:updateComponentValue" action="{!c.updateValue}" />

Note that what I'm implying is that you must communicate across the Visualforce/Lightning barrier via events. You can listen for Lightning Events in Visualforce, and you can listen for Lightning Events initiated outside of Lightning to update your component's state. See Firing Lightning Events from Non-Lightning Code as an example.

Source Link
sfdcfox
  • 501.7k
  • 21
  • 473
  • 828

You need to fire an event at your component. I don't have time to actually test this, but something like the following should work:

<!-- Visualforce snippet -->

<script>
function sendDataToLightning(el) {
  var evt = $A.get("e.c:updateComponentValue");
  evt.setParams( { value: el.value } );
  evt.fireEvent();
}
</script>
<input type="text" onchange="sendDataToLightning(this);" />

<!-- Lightning component snippet -->

<aura:handler event="c:updateComponentValue" action="{!c.updateValue}" />