insert 3rd party generated token into a hidden field

Home Forums Quform WordPress insert 3rd party generated token into a hidden field

This topic is: resolved

This topic contains 4 replies, has 2 voices, and was last updated by  jusimedia 7 months, 2 weeks ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #28538

    jusimedia
    Participant

    Hi Ally,

    We are trying to implement a third party script that generates a unique token and inserts it into a hidden field.
    Their installation instructions call for a hidden field and the script uses the field ID to place the token.

    In quform, it does not appear that hidden fields are given a field ID (at least not that I was able to find in the page source)., so essentially the script is generating the token but doesn’t know where to store it.

    How can I use a callback function (documentation here: https://leadid.zendesk.com/hc/en-us/articles/208137433-Callback-Function-Implementation) in order to store the token in the correct field?

    Here’s the script that generates the token.

    //<script id="LeadiDscript" type="text/javascript">
    // <!--
    (function() {
    var s = document.createElement('script');
    s.id = 'LeadiDscript_campaign';
    s.type = 'text/javascript';
    s.async = true;
    s.src = '//create.lidstatic.com/campaign/cc986f16-0b7b-2d3c-f707-28ced084668f.js?snippet_version=2';
    var LeadiDscript = document.getElementById('LeadiDscript');
    LeadiDscript.parentNode.insertBefore(s, LeadiDscript);
    })();
    // -->
    </script>
    <noscript><img src='//create.leadid.com/noscript.gif?lac=e1df6747-0819-2953-b557-24a7256bf099&lck=cc986f16-0b7b-2d3c-f707-28ced084668f&snippet_version=2' /></noscript>
    #28577

    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #28938

    jusimedia
    Participant

    Hi Ally, this is working great – now I need to implement TrustedForm and am having some difficulty.

    Here is the script which I’ve installed in Quform -> settings -> custom JS that creates a hidden field with the Trusted Form certificate.

      (function() {
          var field = 'xxTrustedFormCertUrl';
          var provideReferrer = false;
          var invertFieldSensitivity = false;
          var tf = document.createElement('script');
          tf.type = 'text/javascript'; tf.async = true;
          tf.src = 'http' + ('https:' == document.location.protocol ? 's' : '') +
            '://api.trustedform.com/trustedform.js?provide_referrer=' + escape(provideReferrer) + '&field=' + escape(field) + '&l='+new Date().getTime()+Math.random() + '&invert_field_sensitivity=' + invertFieldSensitivity;
          var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(tf, s); }
      )();
    

    When I view the source code, I see the hidden field and value being generated but its’ not being captured in the form entry.

    How can I get the circled data in the above image to show up in the form entry?

    • This reply was modified 7 months, 2 weeks ago by  jusimedia.
    #28953

    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    • This reply was modified 7 months, 1 week ago by  Ally.
    #28959

    jusimedia
    Participant

    I actually got this to work a different way –

    Inserted the script into the form itself and renamed the var field = ‘quform_9_151’; to correspond with the hidden field.

    Thanks!!

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

Be inspired. © 2019 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy