I have a pretty advanced <table> with cells that I need to be able to edit and save/update frontend. Therefor I thought that acf_form would be the way to go here after creating all <td> as custom fields.
My problem is that it’s not so easy to setup the html for acf_form.
So either I want to output all <input id=”field…>” (like attached image) and the do alot of appendto for each <td>.
Or instead create one acf_form for each <td> and at the bottom of the table add a button to submit all my acf_forms. I guess this the best way. But how do i output multiple forms (one for each custom field) on a single post and only one button to submit them all?
In this case, you need to set the form option to
false and add the form and submit button tag manually. This page should give you more idea about it: https://www.advancedcustomfields.com/resources/acf_form/. It should be something like this:
<form id="post" class="acf-form" action="" method="post"> <?php acf_form(array( 'field_groups' => array(7), 'form' => false, )); ?> <?php acf_form(array( 'field_groups' => array(9), 'form' => false, )); ?> <div class="acf-form-submit"> <input type="submit" class="acf-button button button-primary button-large" value="Update"> <span class="acf-spinner"></span> </div> </form>
I hope this helps 🙂
Its been a few years but i’m just picking up on this example. I have it working but it’s saving to the page postID and not the ID of the CPT that i want to save too. Is there a way to do it this way. Normally i can just put the postID in the the acf_form and it works but that won’t work for the page i’m building.
Could you please tell me how, in your previous example, I can add the following code, in order for me to create a new post ?
'new_post' => array( 'post_type' => 'questionnaire_ws', 'post_status' => 'publish', 'post_title' => 'lorem test', ),
My goal is to create a post type “questionnaire_ws” with multiple acf groups 🙂
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2021 Advanced Custom Fields. Subscribe