Does anyone know how I could use or pass ms-data to info to a 3rd party embedded form I have built on paperform.co? I have the form embedded on my site in my user only section.
Sweet! Would you mind sending the text version? I bet that will save Tyler some time
Of course I included it but it didn’t show up. Im a rookie lol
div data-paperform-id=“onehub”>(function() {var script = document.createElement(‘script’); script.src = “https://paperform.co/__embed”; document.body.appendChild(script); })()</script
A bit of custom code can do this. Take a look at the input IDs generated by paperform. Assuming they are static (i.e. they are always the same for every user), then you have at least a couple options: (1) use the setAttribute() method to add the correct MemberStack ms-data
attribute to the paperform input, or (2) populate the paperform input using JavaScript like this:
MemberStack.onReady.then(function(member) {
document.getElementById("paperformIDforlastname").value = member["lastname"];
})
If paperform uses names or classes instead of IDs, this is still doable.
Here is example code that pre-fills the name and email. It uses @Scott’s idea of setAttribute
which should work great for this.
<div data-paperform-id="onehub"></div>
<script>
MemberStack.onReady.then(function(member) {
var name = member["name"]
var email = member["email"]
var pf = document.querySelector("[data-paperform-id='onehub']")
var prefill = "name=" + name + "&email=" + email
pf.setAttribute("data-prefill",prefill)
var script = document.createElement('script');
script.src = "https://paperform.co/__embed";
document.body.appendChild(script);
})
</script>
Fantastic! Thank you so much.