My Account

Forums

Home Forums General Events vanilla JS

Viewing 4 reply threads
  • Author
    Posts
    • #34984
      Tim Littley
      Participant

      Does anybody have an example of vanilla javascript event listener for WS Form? Or does it have to be wrapped in jQuery function?

      I was hoping this would work:

      document.addEventListener('wsf-rendered', function() {
      console.log ("rendered");
      });

      Cheers,

      –Tim

    • #34985
      Mark Westguard
      Keymaster

      Hi Tim

      Our triggers are jQuery and not native so you would need to use a jQuery wrapper and use ‘on’ to detect that event per our knowledge base page.

      Run JavaScript on Form Load

      Thanks!

      Mark

    • #35485
      Tim Littley
      Participant

      Thanks for clarifying Mark,

      Speaking of events. I think I know the answer but does WS Form have a separate “rendered” event for modal? The current rendered event fires on page/form load. If modal has not yet been triggered then the form (within the modal) is not really 100% rendered.

      I don’t think WS Form fires a second rendered event when a modal is opened, could be wrong though.

      Cheers,

      Tim

      • This reply was modified 8 months, 3 weeks ago by Tim Littley.
    • #35505
      Mark Westguard
      Keymaster

      Unfortunately there is no way for us to know if a form has been loaded in a modal or not, but if the modal fires the required JavaScript to render the form, it’ll use the same wsf-rendered event.

    • #35668
      Tim Littley
      Participant

      Got it thanks. My particular modal implementation does render the form before the modal is visible, i.e. the rendered event fires.

      I think where I was having some difficulty is that not all of the objects in the form are computed until after the modal becomes visible (based available viewport). In any case I found a workaround.

      Thanks,

      Tim

Viewing 4 reply threads
  • You must be logged in to reply to this topic.

Login