Home › Forums › Quform WordPress › insert 3rd party generated token into a hidden field
- This topic has 4 replies, 2 voices, and was last updated 5 years ago by jusimedia.
- AuthorPosts
- February 12, 2019 at 9:17 pm #28538jusimediaParticipant
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>
February 18, 2019 at 11:21 am #28577AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
April 2, 2019 at 5:40 pm #28938jusimediaParticipantHi 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 5 years ago by jusimedia.
April 5, 2019 at 5:37 am #28953AllySupport StaffYou 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 5 years ago by Ally.
April 5, 2019 at 5:19 pm #28959jusimediaParticipantI 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!!
- AuthorPosts
- You must be logged in to reply to this topic.