• Hi Kodie

    Great Plugin however I’ve discovered when a user selects ‘Save & Continue’ and they revisit to form to continue editing at a later date, all the values entered in the repeater fields are lost… Native GF forms all remember their values, just all fields with repeater is lost and user has to begin again. Is this an issue that can be fixed asap? thanks in advance

    WordPress: 4.4.2
    Gravity Forms: 1.9.18
    Repeater: 1.1.0-dev14

    https://www.ads-software.com/plugins/repeater-add-on-for-gravity-forms/

Viewing 15 replies - 1 through 15 (of 15 total)
  • Jessie

    (@jproffitt71)

    I investigated this and found that the repeater stores and loads its values from a cookie using this library: https://github.com/ssut/jQuery-PostCapture

    There is no mechanism for saving the child field values on the server side so they get lost as soon as the cookie is reset.

    To fix this, someone would need to rewrite the repeater field to get/ save the child field values along with its own configuration data. Then it could be persisted with the other fields, and the javascript could load the values from the repeater element itself.

    Jessie

    (@jproffitt71)

    It is possible to fix this. I overrode get_input_value_submission in GF_Field_Repeater and saved submitted child values in with the configuration information, then read the initial input values from there in repeater.js.

    I can provide a zip or gist if anyone desires.

    We experienced the same behaviour over here and look forward to a solution/fix. Thanks in advance.

    JProffitt71 – Yes, I would like the files. Can you post via Pastie or using code tag here with some instructions?

    Definitely would like to see your solution. We’re using the persistence add-on and are experiencing the same issue. Looking at the database, the repeated values are stored in a nice JSON string, but not retrieved when the user returns to the form. I suspect “persistence” doesn’t have a mechanism to parse the JSON and re-populate the fields.

    Would love a copy of that as well JProffitt71.

    Jessie

    (@jproffitt71)

    Sorry for the delay. I tried forking the git project, but the master branch was too out of sync with the distributed plugin for me to merge in my changes right now, so here is a straight zip of my modified version: https://www.dropbox.com/s/la5b001ao1rcpz1/repeater-add-on-for-gravity-forms.zip?dl=1

    The only files I modified were class-gf-field-repeater.php and js/repeater.js / js/repeater.min.js, so you can inspect/copy just those files if you’re (rightfully) concerned about security. The gist of it is I modified the repeater field to store all the child values in its hidden field where it stores the number of children submitted. Then I modified the javascript to recognize this extra data and pull from the hidden field instead of the cookie or wherever it was getting the values from now.

    Concerns:

    – There is a lot of input name transformation going on back and forth between the php side and the html/javascript side. Theres a lot of room for error, particularly with compound fields like the address fields (I tested that successfully in this case).
    – Tried to force it to handle child input through their actual respective fields, rather than grabbing / saving the posted data directly. Not sure if this is more or less reliable.

    Awesome much appreciated let me know if you have a link I can send a donation too for providing a fix for that.

    Got this error on install. Notice: Array to string conversion in /home/staging7/public_html/wp-content/plugins/gravityforms/gravityforms.php on line 3292 from the code above didn’t mess anything up but wondering if anyone else got the same error.

    I have resorted to the List field type as this extension is no longer being actively supported.

    Jessie

    (@jproffitt71)

    Ah, I am working with an older version of Gravity Forms, 1.9.17.5, so I cannot see what code is generating that notice.

    I don’t imagine you are allowed to post the relevant snippet of the code raising the notice, so what I would suggest for finding its source is inserting a type check on the line before it for the variables that may be arrays. If one of them is an array, print it to log along with a backtrace. Like so:

    if (is_array($myVar)) {
      error_log(print_r($myVar, 1));
      error_log(print_r(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), 1));
    }

    That’ll output extra information to either your-site/error_log or your-site/wp-admin/error_log (unless your server is configured to put them somewhere else).

    I’m concerned about that notice because it usually means something is being passed in wrong and lost.

    Can you update your profile with site so I can contact you about it or reach me on skype at [redacted]

    @jalexanderphd: Please do not solicit contact via email or Skype. Posting your Skype id or asking others to contact you off forums is really frowned upon here. This is to protect users and to prevent people from trying to solicit work or harvest email addresses from the forums.

    Additionally, the point of these community-based forums is to help each other in a public space so that the whole community can benefit from the discussion and any solutions proposed. Private discussions take this benefit away. If you would prefer a one-to-one discussion, please try https://directory.codepoet.com/ or https://jobs.wordpress.net/

    Jessie

    (@jproffitt71)

    I think the best way to handle code/issue discussion is via github. This is (I assume) the authors github project for this plugin: https://github.com/kodie/gravityforms-repeater

    I forked it, but have not committed my changes since the master branch is ahead of the plugin release: https://github.com/jproffitt3ge/gravityforms-repeater/tree/enhancement-save-child-values

    What I could do is rebase my branch off of the last release (1.0.9), then we could ignore the rest of the changes made after that. I can do that this weekend, and then you could post an issue there.

    I also forgot that the base Gravity Forms plugin is public: https://github.com/wp-premium/gravityforms

    So you can also probably cite the problematic code here, assuming it’s not making use of an add-on.

    Sorry ESMI wasn’t trying to solicit services was trying to contact him for work found his site and reached out that way. Will take a look at that as well thanks JProffitt71.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Values lost & not compatible with 'Save & Continue'’ is closed to new replies.