4 Replies Latest reply on Jun 23, 2017 10:26 AM by Charles Sanderson

    Form reply, in-page w/html etc.

    Charles Sanderson

      We've used a simple javascript on our landing pages that, if turned on, keeps a user on the landing page and displays a message.

       

      The message itself is just a mktoString metatag in the landing page template, so that we can change the message.

       

      We've run into a few occasions, where we wanted more than just a message - html, a link. a way to reload the page. But I don't believe those are feasible using just a mktoString Token, which I don't believe can accept html, and wouldn't be efficient if it could I suspect.

       

      Any suggestions? How have other people solved this problem?

       

      For reference, if relevant. the javascript:

      <script>

      if (${formsendrule}) {

      MktoForms2.whenReady(function (form){

        form.onSuccess(function(values, followUpUrl){

          form.getFormElem().hide();

          document.getElementById('confirmform').style.visibility = 'visible';

           return false;

        });

      });

      };

      </script>

       

      Metatag:

      <meta class="mktoString" id="formmessage" mktoName="Form fill reply" default="Thank you! We will be in touch soon.">

       

      Metatag location:

      <div id="confirmform" style="visibility:hidden;z-index:15;width:100%;height:100%;margin-top:10px;padding:10px;"><p><strong>${formmessage}</strong></p></div>

        • Re: Form reply, in-page w/html etc.
          Charles Sanderson

          hmmm. this might have been the simplest oversight ever.. Forgot there was an attribute: allowHtml="true"

           

          Gonna try that, and see if it solves my needs.

          • Re: Form reply, in-page w/html etc.
            Gerard Donnelly

            This might work, its what I do. In the MarketoThankYou div you can add whatever you want.

             

            <script src="//app-xxxx.marketo.com/js/forms2/js/forms2.js"></script>

              <form id="mktoForm_1234"></form>

              <script>MktoForms2.loadForm("//app-xxxxx.marketo.com", "313-HPA-913", 1234, function(form){

              //Add an onSuccess handler

              form.onSuccess(function(values, followUpUrl){

              dataLayer.push(

              {event: 'mktoLead'}

              );

              //get the form's jQuery element and hide it

              form.getFormElem().hide();

              //return false to prevent the submission handler from taking the lead to the follow up url.

              $("#MarketoThankYou").show();

              return false;

              });

              });</script>

              <div id="MarketoThankYou" style="display: none;">

              <p>Thank you. Your message has been received. Someone will contact you shortly.</p>

              </div>