Support

Account

Home Forums Front-end Issues Front-End Form default image and loss of post type

Solved

Front-End Form default image and loss of post type

  • Following the instructions from http://www.advancedcustomfields.com/resources/filters/acf-pre_save_post/ to create a new form to submit images for a custom post type via front-end.

    Initial setup works well but a few strange behaviors I’m noticing:

    1. Whenever I come back to the field group settings page it does not maintain the selection for location rule. If I make any changes to a field and do not explicitly chose to re-apply it to my custom post type (galleries) instead of the auto-default (post), my submissions go to the wrong location.
    2. The front-end form has a default photo in it. This seems to apply whether I am logged in or not and *may* be the first photo I happened to upload but not sure. Either way, quite strange that I need to remove the photo in order to select to add new.
    3. The Image field Group has settings to Return value ID and library = uploaded to post. Yet when I access this (as admin) I see all media library options. Haven’t tested with other user so I assuming for now it is role based.

    Once I can confirm that the single photo process works smoothly I’ll be purchasing the add-on to do the multi-image uploads as that is the real goal for front-end submission for photos.

    WordPress v3.8
    ACF v4.3.4

    • Elliot

    • January 29, 2014 at 10:55 am

    Hi @idealien

    Thanks for the questions.

    1. Can you clarify what you mean by this? Is the location rule not saving? If so, what is the location rule? You say my submissions go to the wrong location, please note that it is up to your code to insert the new post to the correct post_type.

    2. This is most likely the first value saved. What code are you using for the acf_form options?

    3. This may be a JS bug when in the front end form. Perhaps you can provide a link for me to take a look and test?

    Thanks
    E

  • 1) When I go to the Custom Fields edit screen and change the location rule my group applies to CPT (gallery) it will save to that type. All subsequent form entries go to the CPT. But when I go back to the custom field edit screen, the drop-down displays as default post. Essentially every time I go back to the form I have to manually change the location back to CPT option.

    2) With acf_form_head(); above get_header() call in a child theme of http://320press.com/wpbs/ in a very vanilla page template I have the following:

    <?php 
    $args = array(
    'post_id' => 'new',
    'field_groups' => array( 252 )
    );
     	
    acf_form( $args ); 
    ?>

    3) Unfortunately it’s all in local dev atm. But followed very closely to the instructions from http://www.advancedcustomfields.com/resources/tutorials/using-acf_form-to-create-a-new-post/ for it. Dev environment is a vagrant VM and Capistrano/Composer stack based on Roots.io bedrock mostly.

    Thanks

  • #2 has been resolved thanks to this thread – http://support.advancedcustomfields.com/forums/topic/front-end-form-values-staying-filled/ – about pre-populated values with _new in the options table.

    • Elliot

    • January 30, 2014 at 2:14 pm

    Hi @idealien

    I don’t understand what you wrote in question #1. Can you please clearly state the issue? Perhaps some screenshots or a screencast would bypass any english barriers.

    Thanks
    E

  • Issue: Field Group location rule is being stored to database but is NOT being shown as selected when viewing the Field Group.

    Steps to reproduce:
    1) Go to Custom Fields menu
    2) Select Add New Field Group from top of page. Title: Gallery Details
    3) Create fields (XML at bottom of this post)
    4) Select Location Rule = Show this field group if Post Type is equal to gallery.
    5) Publish Field Group.
    6) Go to Gallery Post Type edit screen and the ACF form is there.
    7) Go back to Field Group and Edit Gallery Details.
    8) The Location Rule defaults back to Post Type = post.
    9) If I update anything in the field group and do not also re-change the location rule back to Post Type = gallery, the ACF form will be moved from gallery CPT to post.

    I *believe* the issue is related to my initial choice to use _ in my field names (gallery_photo, gallery_event, gallery_photographer) causing the location group to return to default.

    • Elliot

    • February 2, 2014 at 12:57 pm

    Hi @idealien

    Just to clarify, if you change your field names to not use a prefix of ‘_’, then the issue resolves itself?

  • Yes. It applies to a _ anywhere within the field name too.

  • This reply has been marked as private.
Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.