@bleckett - I am no programming master BUT we were able to accomplish pre-populating field values from another form on demand using simple jQuery and the following steps:.
1. Set the confirmation action of the page 1 form to redirect and select "Pass Field Data Via Query String".
2. Build the appropriate query string as shown in the example. For example: firstname={First Name::1}&lastname={Last Name::2}&address1={Address 1::3}&address2={Address 2::4}&city={City:5}&state={State::8}&zip={Zip::6}&email={Email::9}&phone={Phone::7}&birthdate={Birthdate::10}
3. setup hidden fields on the page 2 form for each of the page one variable being passed and in the advanced tab of each hidden field, check "Allow field to be populated dynamically" and set the parameter to the name of the appropriate field variable being passed from page 1.
4. In the header (header.php in WP), place jQuery code, similar to the following, before the </head> tag (change the field ID's and GET values to match yours):
[js]
jQuery(document).ready(function() {
jQuery("#choice_1_1").click(function(){
if (jQuery("#choice_1_1").is(":checked")){
jQuery("#input_2_7").val("<?php echo $_GET['address1']; ?>");
jQuery("#input_2_8").val("<?php echo $_GET['address2']; ?>");
jQuery("#input_2_9").val("<?php echo $_GET['city']; ?>");
jQuery("#input_2_10").val("<?php echo $_GET['state']; ?>");
jQuery("#input_2_11").val("<?php echo $_GET['zip']; ?>");
}else{
jQuery("#input_2_7").val("");
jQuery("#input_2_8").val("");
jQuery("#input_2_9").val("");
jQuery("#input_2_10").val("");
jQuery("#input_2_11").val("");
}
});
});
Hope this helps!
Posted 13 years ago on Saturday September 10, 2011 |
Permalink