JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.
We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.
Prepopulate Fields From Page ContentAsked by woodlandrlh on March 17, 2016 at 04:16 PM
I've been searching for a few days to this answer and I've gotten close but no cigar. I'm trying to get some of the copy from the page my jotform is embedded on, via wordpress, into some hidden fields. I've tried this:
var comm = $('#element-51 h1').text();
but I don't really know what I'm doing. Heck, I don't even know if what I want is possible. Any information would be very much appreciated.
You did not mention where you are getting the values that you want to use to prepopulate the form. Are using POST data method?
If it is you will have to use a server-side programming (i.e PHP) to create the page that will populate the fields on the embedded form on the website.
user guide: PHP-Forms-Explained
You can also review this similar discussion thread
There is a more simpler method. That is by using the page URL with paramater values to populate fields in the embedded form on the website.
Try this URL on your browser:
the result should be like this
Hope this help. Let us know if you need further assistance.
Firstly, thanks for taking the time to answer my question; and so quickly!
Sorry but I should have been more implicit in my description. I would like to get the values from some of the page elements into the form. My example script was attempting to put the text "1 to 150 Acres Available" into the First Name field, as a test.
I'm already updating my hidden fields via the URL, utm tracking stuff, but I don't want to have each of the links in my site stuffed with variables. (The link I sent is just a test landing page not the full site)
I found something of answer in this forum that lead to this jsfiddle http://jsfiddle.net/L4mWh/4/ but I can't make heads or tails of what's going on.
If I am not mistaken you were referring to this thread http://www.jotform.com/answers/343411
You will probably have to use your form source code to embed on your website because you will need to inject jquery functions to it.
The 'text' value you were trying to use in your test to popuate the First Name field has an input ID as 'element-2'
will you be able to use source code embed of the form on your WP page? This might be an essential requirement for the whole function to work.
Let us know how we can be of further assistance.