Jump to content

aandresen

Member
  • Posts

    2
  • Joined

  • Last visited

Community Answers

  1. aandresen's post in How to run custom code on form submit error was marked as the answer   
    For anyone else reading this, I figured out a way to make this work by continuously looking for the form's error field inside the iframe then calling my function to resize if it's present:
    var foundFormError = false; window.setInterval( function() { if (!foundFormError) { var ctas = document.querySelectorAll(`iframe[id^="cta-iframe"]`); ctas.forEach(cta => { var iframeContent = document.getElementById(cta.id).contentWindow.document; if (iframeContent.getElementsByClassName('field-error').length > 0) { foundFormError = true; // resize here! } }); } }, 100);  
×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.