Want to pass values from one Contact Form 7 form to another in WordPress? I will propose a Javascript solution but there are some caveats (below):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | jQuery(document).ready(function($){ $('#quick-quote form:first').submit(function(){ var foo = {}; $(this).find('input[type=text], select').each(function(){ foo[$(this).attr('name')] = $(this).val(); }); document.cookie = 'formData='+JSON.stringify(foo); }); var ff = $('#container form:first'); if(ff.length){ var data = $.parseJSON( document.cookie.match('(^|;) ?formData=([^;]*)(;|$)')[2] ); if(data){ for(var name in data){ ff.find('input[name='+name+'], select[name='+name+']').val(data[name]); } } } }); |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.