Sometimes you want to add Google Form to your website's members area but do not want members to type their info again as it's already collected during registration. You can pre-fill some data in this form using AuthPro protection code and embedding form using iframe.
<p id="info"></p> <script src="https://www.authpro.com/auth/ACCOUNT/?action=pp&no_redirect=1&get_profile=1"> </script> <script> if (auth_res=='ok') { var iframe = document.createElement("iframe"); iframe.src = "https://docs.google.com/forms/d/e/..."; iframe.width = "100%"; iframe.height = "100%"; iframe.frameBorder ="0"; iframe.scrolling = "0"; iframe.style.border= "none"; iframe.style.background = "white"; document.body.appendChild(iframe); } else { document.getElementById("info").innerHTML="Please login to submit this form"; } </script>
iframe.src = "https://docs.google.com/forms/d/e/1FAIpQLSdPb5KPQFY3Vq5kpig7-JLKrz9P2utdBqMmqgKSQvxxq0WdWg/viewform?usp=pp_url&entry.789818768=USER&entry.2092238618=NAME&entry.1556369182=EMAIL";should be changed to:
iframe.src = "https://docs.google.com/forms/d/e/1FAIpQLSdPb5KPQFY3Vq5kpig7-JLKrz9P2utdBqMmqgKSQvxxq0WdWg/viewform?usp=pp_url&entry.789818768="+login+"&entry.2092238618="+name+"&entry.1556369182="+email;You need to be careful here with variable names, quotes and plus signs, any mistype will make whole code non-functional. Here is sample working code:
<p id="info"></p> <script src="https://www.authpro.com/auth/demo_gs_new/?action=pp&no_redirect=1&get_profile=1"> </script> <script> if (auth_res=='ok') { var iframe = document.createElement("iframe"); iframe.src = "https://docs.google.com/forms/d/e/1FAIpQLSdPb5KPQFY3Vq5kpig7-JLKrz9P2utdBqMmqgKSQvxxq0WdWg/viewform?usp=pp_url&entry.789818768="+login+"&entry.2092238618="+name+"&entry.1556369182="+email; iframe.width = "100%"; iframe.height = "100%"; iframe.frameBorder ="0"; iframe.scrolling = "0"; iframe.style.border= "none"; iframe.style.background = "white"; document.body.appendChild(iframe); } else { document.getElementById("info").innerHTML="Please login to submit this form"; } </script>