Viewing 2 reply threads
  • Author
    Posts
    • #7754
      jrcreative
      Member

      Hi all,

      I’m in desperate need of a solution for this. I have a multi-page front end form with many different required file uploads.

      Piklist does a fine job of making sure you can’t move to the next page without submitting the required info. However, when you go back to that page after advancing in to process, you can see that the image is stored here…

      Screen Shot 2017-01-26 at 10.10.37 AM

      But when you attempt to move on again, it acts as if it doesn’t know the file exists (despite the fact that you’re looking at a preview).

      I’ve been working at this for a while, looking for ways to even work around Piklist for this one input type, but I’m not having any luck getting it integrated back into the Piklist flow.

      HELP!!

    • #7772
      jrcreative
      Member

      Good news! I’ve come up with a solution.

      My first idea was to pre-populate the file input value based on the contents of post_meta and couldn’t figure out why that wasn’t working until I found that it’s actually a security feature to disable that behavior.

      So I decided to make the file field conditionally required. If no file is in post_meta I require the field, otherwise you can update the info, but it’s not required.

      piklist('field', array(
      	'type' => 'file'
      	,'scope' => 'post_meta'
      	,'field' => 'government_id'
        ,'description' => __('This can be a driver\'s license, passport, or other official document with your name and photo.')
      	,'label' => __('Government Issued Photo ID')
        ,'required' => get_post_meta( $post_id, 'government_id', true ) ? false : true
      ));

      It’s not a perfect solution. If someone had previously uploaded a file and came back to the form, they could remove the image with the “Deselect” button and move forward without the file in place. For me, it’s better than not requiring the field.

    • #8309
      LEO
      Participant

      Hello!

      Please, tell me, how do you realize multi-page front end form ? With small demo and example code, please.

      Thanks so much/

Viewing 2 reply threads
  • You must be logged in to reply to this topic.