Support

Account

Home Forums Front-end Issues Load fields in front end form

Solved

Load fields in front end form

  • Please, help, how to dynamically load fields in front end form (or update front-end form)?…

    • Elliot

    • July 23, 2013 at 3:44 pm

    Hi @trasyhoob

    Your question is to vague for me to answer correctly.

    Can you please elaborate?

    Thanks
    E

  • Hello, I have a number of taxonomies, frond end ACF form and html-select of this taxonomies. I want to load group of fields which match selected taxonomy dynamically… (via ajax)… how i can do this…?

    • Elliot

    • July 24, 2013 at 12:32 pm

    Hi @trasyhoob

    Just to clarify, are you saying:

    You have a front end form for editing a post. When you select a taxonomy value for this post, you would like ACF to load in any new field groups which now match (like in the wp-admin)?

  • I’m trying to do something similar I think. I need to insert a new post on the frontend. I’m doing something like the following:

    acf_form(array(
         'post_id'=> 'new',
         'field_groups'=>array(123, $AllFieldgroupsAssignedToThisPostType)
         );

    How can I get the field_groups assigned to the post type?

    • Elliot

    • August 13, 2013 at 2:23 pm

    Hi @wullaski

    This is possible by running the ACF location rule match functionality based on the current screen.

    something like this should work:

    
    <?php 
    
    // get field groups
    $filter = array(
    	'post_type' => 'post',
    	'post_id' => 0
    );
    $field_groups = array();
    $options['field_groups'] = apply_filters( 'acf/location/match_field_groups', $field_groups, $filter );
    
    ?>
    

    Note: this is based of the api.php -> acf_form function and has not been tested

  • Worked like a charm. Thanks for the help.

Viewing 7 posts - 1 through 7 (of 7 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.