Tagged: file upload, form, Front End, Required, validation
- This topic has 2 replies, 2 voices, and was last updated 4 years, 6 months ago by
LEO.
-
AuthorPosts
-
-
January 26, 2017 at 2:27 pm #7754
jrcreativeMemberHi 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…

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!!
-
January 27, 2017 at 7:00 pm #7772
jrcreativeMemberGood 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.
-
July 16, 2017 at 2:37 am #8309
LEOParticipantHello!
Please, tell me, how do you realize multi-page front end form ? With small demo and example code, please.
Thanks so much/
-
-
AuthorPosts
- You must be logged in to reply to this topic.