Guest Posted June 1, 2020 Share Posted June 1, 2020 Hello, I am using Memberspace for managing member and Jotform to submit member request in a Memberspace protected page. I am trying to pass member data specifically First Name, Last Name, email, and cell phone number (this is a custom field in Memberspace regsitration form), but have not been successful. This is what I am doing: I code injected the following in the header (setting > advance > code injection) below the required Memberspace install script: <script> var namaDepan; var namaBelakang; var eMail; var noHP; (function() { MemberSpace.onReady = MemberSpace.onReady || []; MemberSpace.onReady.push(function(args) { if (args.member) { /* Your custom code goes here */ namaDepan = args.member.firstName; namaBelakang=args.member.lastName; eMail=args.member.email; noHP=args.member.customField11284; document.getElementById("namadepan").innerHTML = "<p> Halo " + namaDepan + ", apa kabar?</p>"; /* to test whether data can be passed*/ } }); }()); </script> With the above code I can write the first name of a member anywhere in the page as long as I marked the location with id="namadepan". However when I try to pass the variable {namaDepan} to Jotform code it appears the value of {namaDepan} is not passed. This is what I do with Jorform code (in the iframe part) - the Jotform code is written in a Code Block in the page: <iframe id="JotFormIFrame-201448534058051" title="Barang Dibutuhkan" onload="window.parent.scrollTo(0,0)" allowtransparency="true" allowfullscreen="true" allow="geolocation; microphone; camera" src="https://form.jotform.com/201448534058051?name[first]="+namaDepan+"" frameborder="0" style=" min-width: 100%; height:539px; border:none;" scrolling="no" > </iframe> However, if in the statement src="https://form.jotform.com/201448534058051?name[first]="+namaDepan+"" if I change it into src="https://form.jotform.com/201448534058051?name[first]=John" it works. So if I use just manual inputed value it works, but if I try to pass a variable it wont work. Please if anybody have any way to solve this issue please let me know. Thank you all in advance. Best regards, Wantya Link to comment
Guest Posted June 3, 2020 Share Posted June 3, 2020 Hello All, I have found the solution, I code injected the following in the header (setting > advance > code injection) below the required Memberspace install script: <script> var namaDepan; var namaBelakang; var eMail; var noHP; (function() { MemberSpace.onReady = MemberSpace.onReady || []; MemberSpace.onReady.push(function(args) { if (args.member) { /* Your custom code goes here */ namaDepan = args.member.firstName; namaBelakang=args.member.lastName; eMail=args.member.email; noHP=args.member.customField11284; document.getElementById("JotFormIFrame-201448534058051").src = "https://form.jotform.com/201448534058051?name[first]="+namaDepan+"&name[last]="+namaBelakang+"&email="+eMail+"&noHp="+noHP+""; } }); }()); </script> So basically I add this statement: document.getElementById("JotFormIFrame-201448534058051").src = "https://form.jotform.com/201448534058051?name[first]="+namaDepan+"&name[last]="+namaBelakang+"&email="+eMail+"&noHp="+noHP+"" Thanks All. Wantya Link to comment
tonymelvin Posted October 16, 2020 Share Posted October 16, 2020 @Wantya What changes did you make to the iframe code to get it to work? Link to comment
Kipe Posted March 1, 2022 Share Posted March 1, 2022 Hello, how did you get this to work? I can not get it to work as you have described. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment