2 Replies Latest reply on Apr 21, 2017 1:19 PM by Adam Andrews

    Distinguish Forms in the Javascript API

    Adam Andrews

      I'm trying to build out some advanced form actions with Javascript that rely on distinguishing between the different forms being interacted with. Unfortunately, I can't figure out the best way to figure which form is which in the native page 2.0 embed. As an example:

       

      <script>

      MktoForms2.whenReady(function (form) {

      id = form.getId();

      if (id = 4529){

      alert(id);

      }

      });

      </script>

       

      I would only expect this to send the alert once if one of the forms had an id of 4529. But it will send the alert for every single form so long as one of them has the matching id. Does anyone have some advice on the right way to do this?