- woodlandrlhAsked 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.
- JotForm SupportjonathanAnswered on March 17, 2016 at 04:55 PM
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.
- woodlandrlhAnswered on March 17, 2016 at 05:02 PM
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.
- JotForm SupportjonathanAnswered on March 17, 2016 at 05:43 PM
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.