Jump to content

Passing Memberspace data into Jotform Field

Recommended Posts

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
  • Replies 4
  • Views 1.9k
  • Created
  • Last Reply

Top Posters In This Topic

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
  • 4 months later...
  • 1 year later...
  • 2 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.