Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

204
Views
How to get my LWC to listen to events from FormAssembly form?

I've got FormAssembly installed in my org and it's loading a form on an experience site (community). I'm trying to get my custom LWC on the site to listen to events coming from the form but nothing seems to work.

In my form script tags I'm firing a custom event:

<script>
  window.onload = function() {
  const message = 'testMessage';
  let event = new CustomEvent("formMessage", { detail: message });
  window.dispatchEvent(event);
  console.log('formMessage event fired');
};

</script>

and on my LWC I add the event listener in the connected callback function:

  connectedCallback() {
    window.addEventListener("formMessage", (event) => {
      console.log('formMessage event listener ' +event.detail)
    });
  }

Now I know the forms are embedded in an iFrame but I'm pretty sure I can listen to events coming from there. I've also made sure that the event is firing and that the listener is registered on my LWC before the form fires the event but I still get nothing on the other end.

Any idea what I'm missing?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!