EE 2.9.2 FreeForm 4.2.0

I have a somewhat large form where the client expects users to submit it multiple times per visit. They would like to have 8 of the fields be pre-populated after the first submission.

I'm thinking this needs to be done with cookies but am unsure of how to get the cookies set using the info entered into the the form. Any thoughts on how best to achieve this?

Have looked at cookie addons, but not sure if they will work or if I should approach this with javascript/jquery.

  • Cookies have storage limits, and might cause issues with the size of headers being transmitted every request if you're talking bout a lot of data. Maybe this is a job for localStorage? Mar 19, 2015 at 20:48
  • Derek - would 8 cookies be too much data? or does the size of the data in each cookie count? Will look into local storage - hopefully that works in IE9+
    – CreateSean
    Mar 19, 2015 at 20:59
  • Why not save the data directly to the channel entry with whatever is populated and then pull that data again when the user returns? Or is the user not required to log in where you can associate it to them?
    – DanH
    Mar 19, 2015 at 21:30
  • It'll be painful to use cookies since they're not available until the next page load. You'll want to store the data in ExpressionEngine as you go. You should purchase FreeForm Pro. It handles multi-page forms out of the box. Well worth the cost. - or explore an AJAX solution Mar 19, 2015 at 23:13
  • 1
    Oh, and you're fine on IE9 to use localStorage. http://caniuse.com/#search=localstorage Mar 20, 2015 at 21:36

2 Answers 2


You'll have to write an extension which uses the freeform_module_insert_end hook to save the cookie (or cookies, depending - cookie size is an issue, so maybe one cookie per field?).

Something like:

function freeform_module_insert_end($field_input_data, $entry_id, $form_id, $this)
    $expires = ee()->localize->now + 3600;
    ee()->input->set_cookie('freeform_default_name', $field_input_data['name'], $expires);
    ee()->input->set_cookie('freeform_default_email', $field_input_data['email'], $expires);
    ee()->input->set_cookie('freeform_default_phone', $field_input_data['phone'], $expires);

Then you can use any cookie add-on - Mo' Variables is a good one - to get your cookie when building your form:

<input type="text" name="name" value="{cookie:exp_freeform_default_name}" />

(Note that when setting cookies via the EE Input class, the exp_ prefix is added automatically to your cookie name.)


Or just use the native channel:form tag instead. Save the first time and then use the edit function to load all the data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.