Support

Account

Home Forums ACF PRO Using ACF_FORM ('form' => false)?

Solved

Using ACF_FORM ('form' => false)?

    • Jeff

    • June 23, 2017 at 2:48 am

    In the documentation for ACF_FORM() there is the option 'form' => false,

    Can you direct me to an example of how this is used to “Add to an Existing Form”?

    What I am trying to accomplish is to create a front end Form/Page with a list of Posts, displaying a TRUE/FALSE field that can be modified (Checked/Unchecked) and saved all at once.

    If there is not build in functionality I am planning on building with PHP that embeds each individual post id in a hidden field and then FOREACH though the form and use UPDATE_FIELD. Of course using existing functions is my first choice.

    Thank you for the help.

  • The only difference between acf_form() with form set to true or false is the inclusion of the ‘<form>’ wrapper tags. Everything else about it works the same and the fields are saved in the same way they would normally be saved.

    Other than some topics you might be able to find on this forum, I don’t think there are any examples of using acf_form() this way.

    Not sure if that helps you or not.

    • Jeff

    • June 27, 2017 at 7:26 am

    Thanks John,

    I didn’t think ACF_Form allowed this.

    I ended up writing a function to handle this for me.

  • The only difference between acf_form() with form set to true or false is the inclusion of the β€˜<form>’ wrapper tags. Everything else about it works the same and the fields are saved in the same way they would normally be saved.

    Other than some topics you might be able to find on this forum, I don’t think there are any examples of using acf_form() this way.

    Not sure if that helps you or not.

    This is incorrect information.

    I’m searching Google now for information on how it works, and it certainly doesn’t work like this.

    Not only do I have to manually add my own form tags, I will also have to add my own submit button. I have copied the setup for both form tags and submit inputs from the standard rendering of the form, but clicking submit doesn’t save the values and I get a query string in return that’s ridiculously long.

    Documentation is lacking here. Anyway, I’m adding this in case others are searching for this response and are mislead by the answer above.

    Will write more when I figure it out.

  • Most of the time when using acf_form() without form tags is because you want to add acf fields to an existing form on the site. When you want to do this you need to figure out how to call acf_form() inside the <form></form> tags of the other form. This may not always be possible depending on what is generating the other form and if there are any hooks available that allow you to insert additional information into the forms.

  • Thanks for responding, John.

    I don’t quite understand what you’re saying.

    My challenge is to make two forms post with one submit button. I set form => false on both, add my own form tags and submit button manually, and it doesn’t work. At all. (as described above)

    And there’s nowhere in the ACF docs that I have found where this is explained.

    If you know of any such resources, I’d love to be pointed that way

    thanks!

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