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.

image upload field doesn't retain value upon error in form

  1. equalizer
    Member

    I know file upload fields don't normally retain their value if the form reloads due to an error in another field, but I am wondering if GF might add this in the future. The problem isn't for required fields, but if it's optional. If someone chose an image to upload, then forgets to fill in something else, it would be nice to keep the image path there in case they forget to select it again (or even if they notice, so that they don't have to pick the image file again).

    I was thinking it could check file upload fields specifically for a submitted value and set them upon reloading the form, just the same as any other field.

    Posted 13 years ago on Monday November 8, 2010 | Permalink
  2. For security reasons, file upload fields don't allow you to set it's value dynamically. That is the reason Gravity Form does not keep their values upon validation failure.

    Posted 13 years ago on Monday November 8, 2010 | Permalink
  3. equalizer
    Member

    Doh, you're right. I thought I set it manually on a project I did a couple of years ago, but thinking back, all I did was check to see if the user did submit a file, and if there were other verification problems, I would prompt them to re-select their file upload (since otherwise they would not be prompted since the file was optional).

    Maybe that could be added to the wishlist at some point. I realize it's not that high a priority though.

    Posted 13 years ago on Tuesday November 9, 2010 | Permalink
  4. I believe this can be avoided with javascript validation, I haven't looked into how to set that up with gforms yet though, sorry.

    Posted 13 years ago on Tuesday November 9, 2010 | Permalink