September 12, 2013 at 10:29 pm #8093
I have 4 custom post type that users can upload to. I have created four separate upload forms to allow them the posts go to the correct Custom Post Types with the correct Taxonomies.
What I want to do is create a drop down menu that displays the 4 upload forms I have created. The user will select which form they want to use and then that will be populated in front of them.
Here is my code for two of the forms:
This element seems to work, but when I try to upload a photo, two browse windows pop up. If I add a third form, 3 browse windows open and if I add the fourth form, a fourth browse window opens. This only happens on the first form. The second/third/fourth forms dont open any window at all when trying to browse for an image.
Is there anything I can do to stop this happening?
DamienSeptember 13, 2013 at 12:02 pm #8101
You are using multiple forms in the same page, the problem with the uploader is it works based on CSS ID of those fields and which is based on the meta key. So you are using the same meta key for every forms and those buttons are bind to the uploader and this problem happens.
Either you've to change the meta key for each form or use different pages for forms.September 13, 2013 at 3:59 pm #8103
I can see how that is an issue alright! Changing the meta fields for the images have worked, but there are no meta fields for the Main Photo, the one that feeds to Featured Image. I have tried amending the CSS classes but that has not helped.
Is there a way of adding a meta field to the Featured Image box on the form? Which file would I need to amend?
DamienSeptember 13, 2013 at 4:16 pm #8104
Adding a field is trickier, you should look into
/class/admin-template-post.phpfor modifying the edit form.
/class/render-form.phpfor rendering the form in frontend.September 13, 2013 at 4:18 pm #8105
Without using multiple form, may you can create a dropdown at the top of the form for a pet type and show/hide fields with jQuery based on the value.September 13, 2013 at 4:26 pm #8106
Thats a good idea but would that work with the different Custom Post Types I have set up?
Each of the four forms uploads to a different CPT i.e. Dogs, Cats, Farms, Others.September 13, 2013 at 4:32 pm #8107
That's why filter exists, isn't it? You can change the post type based on the dropdown value by using filter.September 13, 2013 at 5:14 pm #8109
Hmm, I think this is where my coding knowledge begins to lack a little! 🙂
Let me look into this for a little bit! haha
The topic ‘Upload issue when using a drop down form’ is closed to new replies.