PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Saving a Form

  1. Pete Bernardo
    Member

    I did a quick search but did not find any results, I apologize if it has been suggested before.

    My suggestion would be to allow an end user to Save a Form to edit later. To avoid getting in to user management, login, members area... Maybe just ask the user if they want to save, to provide their email (if it was not part of the form) and email them a unique url to the form that populates the fields based on what they previously submitted. The user could just click the link from their email and continue with the form.

    Posted 14 years ago on Tuesday January 5, 2010 | Permalink
  2. We've discussed some options to allow users to save forms but aren't settled at this point on exactly how we'd handle everything. I'm sure it's something that will get implemented in a later release. Thanks for the ideas, we'll keep them in mind.

    Posted 14 years ago on Tuesday January 5, 2010 | Permalink
  3. csenglim
    Member

    I think you guys should have it sooner because it is such a basic thing from the end users perspective and more so the really end end users where the forms are intended for. Hope that this will be part of the next release

    Thank you

    Posted 14 years ago on Sunday April 4, 2010 | Permalink
  4. Functionality like this will most likely not be introduced until we incorporate multi-page forms. That may or may not be part of the next feature release. It depends on a variety of factors as we have some other features that we also plan on adding.

    Posted 14 years ago on Monday April 5, 2010 | Permalink
  5. I recently purchased Gravity Forms and love it!

    Since multiple page forms is now a standard feature, is there any word on the ability for users to save their form to complete later?

    And, on a related note, I would love for my users to have the ability to return to their completed form and update responses.

    Thanks for a great product!

    Posted 12 years ago on Thursday May 26, 2011 | Permalink
  6. No update on saving forms. It is a feature we plan on adding but we want to make sure when we implement it, it's well thought out and easy to use for end users. Ideally we want it to trigger sending the user an email containing a return link they can click on to get back to the form. So it's a bit more complex than just storing values in cookies and pre-populating fields automatically. We want to make it clear to the user what is going to happen when they choose to save their progress.

    Posted 12 years ago on Thursday May 26, 2011 | Permalink
  7. @Carl - thanks for the speedy reply. I can understand the desire to have a smooth system in place (that's what I want for my end user, too!).

    Besides the info in your thoughtful reply, is there any update on a timeline for this kind of feature? I have an existing client and a potential summer client who are interested in a form w/ save and form w/ update capabilities.

    Posted 12 years ago on Friday May 27, 2011 | Permalink
  8. Currently there is no timeline I can give you, we are working on other product development at the moment so i'd hate to give you a timeframe and then not deliver during that timeframe. It is a feature we want to add. Our next major feature release will be 1.5.3, it won't make that release. Hopefully it will make one of the major releases after that.

    Posted 12 years ago on Friday May 27, 2011 | Permalink
  9. I have a 15 page form and this is a feature that would really come in handy. I hope it comes out in the near future... Please keep this post updated.

    Posted 12 years ago on Tuesday June 28, 2011 | Permalink
  10. CloutLaw
    Member

    What about prepopulating a multi-page form from already saved entries in database?

    Posted 12 years ago on Tuesday June 28, 2011 | Permalink
  11. @CloutLaw This can already be done using available API hooks and custom code. You can dynamically populate fields. You would have to write the code to query the entry data and populate the fields dynamically using the available hooks.

    Posted 12 years ago on Tuesday June 28, 2011 | Permalink
  12. I think I have @Carl's suggestion implemented. (Note - the method I described in this thread doesn't work completely - it's updated below. I would edit it in the original entry but that thread's been closed.)

    This assumes users are registered and logged in prior to beginning to fill out a form.

    Here's how to do it if anyone is interested.

    1. In your form, go into each field's Advanced tab and click "Allow Field to be Populated Dynamically. Enter a parameter name - it can be anything, but *it should start with something unique*. This is to distinguish parameter names saved in the wp_usermeta table from those processed normally via Gravity Forms. In the examples below, I've begun my parameter names with "um_".
    2. Change line 909 of forms_model.php to read:

      return apply_filters("gform_field_value_$name", apply_filters("gform_field_value", $value, $name));

      That's a hack of the core code. Ugh, I know. :( If anyone can think of a way around this please let me know!

    3. Add the following to your theme's functions.php file. This will store the named parameters in the wp_usermeta table, and pre-populate them when a user returns to a form they've already filled out:
      // RETRIEVE PARAMETER_NAME FOR FIELDS AND ADD TO WP_USERMETA IF THEY START WITH UM_
      // For this to work you must name the parameters for each field by hand and make them start with 'um_'
      add_action('gform_post_submission', 'save_entry_values', 10, 2);
      function save_entry_values($entry, $form){
          $userid = $entry['created_by']; // retrieve user ID
      
          foreach($form['fields'] as $field) {
              $value = RGFormsModel::get_lead_field_value($entry, $field);
              // check that parameter name is prepended with 'um_'
              // (chosen to designate it as a parameter to be saved in wp_usermeta table)
              // note that if your prepend string is anything other than 3 characters long you will need to change the '3' in the next line
              if($value && substr($field['inputName'],0,3) === 'um_') {
                  update_user_meta($userid, $field['inputName'], $value); // stores parameter_name values in wp_usermeta table
              }
          }
      }
      
      // RUN REVISED GFORM_FIELD_VALUE_YOUR_PARAMETER FILTER
      add_filter('gform_field_value', 'populate_user_meta', 10, 2);
      function populate_user_meta($value, $name) {
          global $user_ID;
          $field_user_meta = get_the_author_meta($name, $user_ID);
          // check if parameter name begins with 'um_' and if so, pre-populate it from the_author_meta
          if(substr ($name,0,3) === 'um_' ) {
              return $field_user_meta;
          // otherwise, pre-populate as normal (either via querystring, shortcode or other)
          } else {
              return $value;
          }
      }
    4. Now we add the "Save and return later" and "Submit" buttons. Note that in the all of the rest of these functions, I'm specifying a specific form on my site - the form with id=8. You'll want to change that in both the functions and filters below to apply to your specific form.
      // ADD A SAVE BUTTON ON TARGETED FORM
      add_filter("gform_submit_button", "form_submit_button", 10, 2);
      function form_submit_button($button, $form){
          if($form["id"] == "8") {
              $save = "<input class='submit' type='submit' name='gform_save_button_".$form['id']."' id='gform_save_button_".$form['id']."' value='Save and Return Later' />";
              $submit = "<input class='submit' type='submit' id='gform_submit_button_".$form['id']."' value='Submit Form for Review &raquo;' />";
              return "$save &nbsp;&nbsp; $submit";
          } else {
              return "<input class='submit' type='submit' id='gform_submit_button_".$form['id']."' value='Submit' />";
          }
      }
    5. If users aren't submitting the form, you won't want to run validation yet, you'll want a different confirmation message, and you may not want email confirmations to be sent out. If all that's true, add these to your functions.php file. Remember to change the form ID #.
      // DO NOT RUN VALIDATION IF USER IS SAVING FORM
      add_filter('gform_validation_8', 'custom_validation');
      function custom_validation($validation_result) {
          if($_POST['gform_save_button_'.$validation_result["form"]["id"]]) {
              $validation_result["is_valid"] = true;
          }
          return $validation_result;
      }
      // OUTPUT DIFFERENT CONFIRMATION MESSAGE WHEN SAVING
      add_filter("gform_confirmation_8", "custom_confirmation", 10, 4);
      function custom_confirmation($confirmation, $form, $lead){
          if($_POST['gform_save_button_'.$form["id"]]){
              // Note the next line includes a shortcode which will output the form underneath the confirmation message.
              // If the original form or the shortcode below has ajax enabled, strange things will happen
              $confirmation = "<div id='gforms_confirmation_message'>Thanks! Your entries have been saved. Return to this page at any time to continue filling out the form.</div> [gravityform id=8 name=Questionnaire title=false description=false]";
              // use the following line instead if you want a saved form to redirect somewhere
              //$confirmation = array("redirect" =>"/sitename/wp/login?action=profile");
          }
          return $confirmation;
      }
      
      // DO NOT SEND CONFIRMATION EMAIL IS USER IS SAVING FORM
      add_filter("gform_disable_admin_notification_8", "disable_notification", 10, 3);
      function disable_notification($is_disabled, $form, $entry){
          if($_POST['gform_save_button_'.$form["id"]]) {
              return true;
          } else {
              return false;
          }
      }

    Hope this helps someone!

    Michelle

    Posted 12 years ago on Thursday August 11, 2011 | Permalink
  13. Anonymous
    Unregistered

    Just want to add my .02 that this feature would be heartily welcomed. We have a long and important form we use with our clients and I field at least one call from them a week complaining about the non-ability to save partial form data and come back to finish it later. We're actually going to pay someone to convert our Gravity Form to a Google Doc Form in order to deal with this, which is a step backwards...

    Keep us posted. Keeping fingers crossed that this happens soon.

    Posted 12 years ago on Friday September 9, 2011 | Permalink
  14. Anonymous
    Unregistered

    Example of how this is being done elsewhere:
    http://www.jotform.com/answers/7486-Do-you-support-multi-sessions#6

    Posted 12 years ago on Friday September 9, 2011 | Permalink