-
sbufsawebAnswered on September 15, 2015 03:31 PM
I haven't been able to get this to work for an iFrame. I have two forms and am trying to grab the submission id of one form and display it on another.
I added sid={id} to the url of the form and that works, however, it displays as "{id}" in the field.
Is there a work around that doesn't involve php?
-
Jonathan JotForm SupportAnswered on September 15, 2015 06:35 PM
I assume this is your form http://www.jotformpro.com/form/52444336536961 ?
Can you please share also to us the URL of your website where you were trying to implement the prepopulate method using the Iframe code embed?
As far as I know, our developer had already implemented this feature.
You can see it working on my test page https://shots.jotform.com/jonathan/webtest/662714-test.html
Let us know how we can be of further assistance.
-
sbufsawebAnswered on September 16, 2015 12:12 PM
The url to go to the page is sites.google.../adminsid={id} and the previous forms submission id seems to populate, but it doesn't on the actual form (see photo below). I've tried via iframe and gadget codes, but no luck.
-
CharlieAnswered on September 16, 2015 02:35 PM
Could you share us the link to your Google site? That would help us better to assess what might be missing.
Viewing the form directly and prepopulating it seems to work: http://www.jotformpro.com/form/52535870789975?adminsid=1234433.
It might be something related to Google site preventing this action.
We'll wait for your response.
-
sbufsawebAnswered on September 16, 2015 03:08 PM
Thanks. Here is the link:
-
BJoannaAnswered on September 16, 2015 04:51 PM
If you want that 318150162993374551 number is displayed in admin field on your embedded form that you need to add ?adminsid=318150162993374551 at he end of your embedded form link.
If you are however trying to pass values form some other form to your embedded form please provide us link of you form from which you are trying to pass data. In this thread my colleague EltonCris has explained how to pass value from one form to another form:
http://www.jotform.com/answers/234321-How-to-pass-value-from-one-form-to-another-form
Let us know if you need further assistance.
-
sbufsawebAnswered on September 17, 2015 08:39 AM
Thank you, but I need to have that field populate dynamically as submission id's are different for each user. :( The url I am using for the iframe is https://secure.jotformpro.com/form/52535870789975?adminsid={id}
A little background on what I'm trying to achieve:
I have 3 forms. One is a request form a manager fills out (this is set up in an iframe). It goes to a supervisor. The supervisor denies or accepts the request (this form is NOT in an iframe, and I have no issues pre-populating data). If there are changes that need to be made, a link is sent to the manager with a submission id (from the original request) to this edit form (this form IS set up in an iframe). For whatever reason, I am unable to pre-populate dynamic data in an iframe. :-/
I actually won't even need the edit form once I can figure out how to pre-populate in an iframe because then I can just leave a couple of hidden fields in the original request form and generate an edit link when the supervisor sends their approval/denial.
-
CharlieAnswered on September 17, 2015 10:08 AM
Hi,
I'm not sure if adding ?adminsid={id} and prepopulating via the URL would work. This is because they might be conflicting one another.
If you want to prepopulate via the iFrame, you need to fetch the data {id} either by using a PHP or a stored variable in the website page, that needs a programming code. On the other hand, if you are prepopulating via the URL (even though the form is embedded in a website), you don't need to add ?adminsid={id} in the iFrame, the URL should directly populating it using this link: https://sites.google.com/a/stonybrook.edu/fsa-change-control-process/edit?adminsid=318150162993374551. No need a custom code. Please try removing ?adminsid={id} in the iFrame, then we'll test via URL to prepopulate.
I noticed also that you seem to be editing the code as of the moment, I see you are now using PHP to echo the submission ID. I believe that would will work, as mentioned earlier, you can learn more about sending posting data by checking these links:
http://www.jotform.com/help/213-Send-POST-Data-From-JotForm-Using-PHP-in-Custom-Thank-You-Page
http://www.jotform.com/help/245-How-to-Setup-Webhook-with-JotForm
I hope that helps.
-
sbufsawebAnswered on September 17, 2015 10:32 AM
Thanks. Playing around with the code a bit to test different things. I can't use php in a google site :(
I removed the ?adminsid={id} from the iframe code. How can I prepopulate via url to the field in the iframe?
-
CharlieAnswered on September 17, 2015 12:05 PM
Please accept my apologies, it seems like prepopulating via URL on an iFrame embed form won't work. I made a couple of test and was able to verify it.
The current method that would work is sending it via POST Data using PHP, but as you have mentioned, Google site doesn't allow PHP.
Adding the code in iFrame will only work if the value is static and not dynamic. The iFrame prevents any external codes or scripts to affect the fields inside the iFrame code. I'm not sure if the Gadgets in the Google site would work, I currently do not have a Google site to test it, but could you try using the Gadgets as mentioned in this guide:
Here's a guide using the old "Embed Form" options: http://www.jotform.com/help/19-Adding-Form-to-Google-Sites
We want to check how the form will be displayed using the Gadgets, if it doesn't use an iFrame, then I believe we can prepopulate via URL. But please do try so that we can also better assess.
We'll wait for you response. Apologies for the confusion.
-
sbufsawebAnswered on September 18, 2015 08:28 AM
Ok, it's now embedded using the Google Gadget code. And no need to apologize, I appreciate the help!
I feel like there may be a way to capture the external url's parameters via javascript, but I'm unfortunately not well versed enough to write a solution. :(
-
CharlieAnswered on September 18, 2015 09:55 AM
Hi,
Thank you for understanding. I'm checking the link again https://sites.google.com/a/stonybrook.edu/fsa-change-control-process/edit?adminsid=318150162993374551, but it needs permission to be viewed.
Could you please switched it to public so that we can further check. We'll wait for your response.
Regarding the Javascript, I believe that would be possible, here are some sample scripts that I saw in some forums:
http://stackoverflow.com/questions/979975/how-to-get-the-value-from-the-url-parameter
However, it is depending on how the form is embedded and if Google Sites allow further changes using Javascript. I'll make further research on it and we'll get back to you as soon as I got an idea about it.
-
CharlieAnswered on September 18, 2015 10:15 AM
Hi,
Here's a test form that I made, but this one prepopulates the form embedded via iFrame, but this uses Javascript so it depends if Google site will run the script. Here's it is: https://shots.jotform.com/charlie/iframe_prepopulate.html?email=test@test.com
The link prepopulates the email field in the form embedded via iFrame.
Here's a screenshot of my code, please read the comments to learn more on how it works.
To see my actual code or copy it, you can get it here: http://pastebin.com/kNMHivWy
I hope that helps.
-
sbufsawebAnswered on September 18, 2015 11:13 AM
Ok, I updated the share settings, so you should be able to view it now.
I'm going to give the script a shot right now and see what happens. Will report back shortly..
Thanks!!
-
sbufsawebAnswered on September 18, 2015 12:29 PM
No luck. Seems to be a security issue. :(
-
BJoannaAnswered on September 18, 2015 12:41 PM
It looks like it's not quite possible if that's the case. Scripts code that we tried to use seems to be not allowed.
Also seems that the gadget also uses iFrame.
I will try to find workaround during weekend. If I found I will update you, but to be honest I am not sure if that is possible.
-
sbufsawebAnswered on September 18, 2015 12:47 PM
Ok, thank you for trying.
-
BJoannaAnswered on September 20, 2015 01:48 PM
I have been tested your form one more time and tried to pre populate fields via URL when form is embedded in Google site by recommended embed option - Gadget.
Seems that this is not possible. I further investigated issue and seems that only way you can make this work is to use some PHP scripting but also seems that Google does not support that.
You can try to put code on some paid hosting that supports PHP. To my knowledge, there are a few free PHP hosting that are available.
For more information about how to do it on PHP site you can look into following threads:
http://www.jotform.com/answers/12353-Pre-populate-fields-in-an-Iframe
-
sbufsawebAnswered on September 21, 2015 12:41 AM
Thank you so much Joanna. Sadly, I am forced to use Google at this time for privacy issues.
-
CharlieAnswered on September 21, 2015 02:48 AM
My knowledge of Google site builder is also limited, but would it be possible to have the Google Apps work or integrated on Google site builder itself? I see that PHP environment can be setup on Google Apps engine, but not sure if that is parallel on Google Site builder. You can check it here: https://cloud.google.com/appengine/docs/php/.
We'll continue to look for alternatives, but unfortunately, it seems like this is a limitation from the Google product itself. Apologies.