I would like to use ACF to create a single use front-end form. My use for this is as a project approval form. The goal would be to allow clients to approve or decline concept art. If approved, the form can no longer be used. If declined, then of course it remains in view. I’ve viewed the documentation regarding acf_form(), but didn’t quite see what I was looking for. I’ve been able to figure out how to use ACF to do some pretty creative and complex things before…but I’m stuck on this. Watch it end up being something ridiculously simple…lol…
Any help would be greatly appreciated.
The thing I would also need is the ability to define the fields in the form, as well as their layout (mainly so it fits in with the theme css and is responsive)…then have it send an email alert to me in the process.
In this example, I would have a select box like you mentioned, a name field, an email field and a text box for notes if declined. If approved, it marks the item as approved, hides the form, then displays some text using the form fields to build it. Something like…”Dee Buttersnaps (firstname.lastname@example.org) approved this design on [datestamp] at [timestamp]”. That action seems pretty easy to do. It’s the rest that I can’t figure out. The acf_form() documentation is pretty slim here. All it really says is put this in a template file and you can edit a post. There aren’t any refined examples that shows you how to only show specific form fields that are tied to custom fields. Name field for the sender of the email, email address (self explanatory), and how to set the subject, etc.
I think it would be GREAT if a form builder was added in to make it easier to create and manage this within the UI. Even if it were only part of the Pro version. It seems like the core functionality is there.
You can specify the fields you want to show in the PRO version. Please take a look at this page to learn more about it: https://www.advancedcustomfields.com/resources/acf_form/.
You can also use the acf/save_post hook to send the email. Please take a look at this page (at the bottom of the page): https://www.advancedcustomfields.com/resources/using-acf_form-to-create-a-new-post/.
Hope this helps 🙂
I have looked at those and while they give the starting info, they don’t show more in depth customizations. Things like how to control how the form is thrown together…or how to include it without having to edit a theme file. Like many new themes, ours has a page builder…so a custom page template isn’t really going to work here if we want to keep things up-to-date with the theme as it updates.
As I mentioned in my initial post, I have looked at those links in great detail and they don’t provide the info I’m looking for. Not to be rude, but I was hoping for a little more help beyond “look at these pages and figure it out for yourself” type answers.
It doesn’t seem like it is possible to do what I am looking for it to do with the kind of control I need. I need to do more than just editing/creating posts from the front end or creating a basic contact form while using a simple WordPress theme. I need to take it to the next level. Hence my suggestion for having this built into the UI of ACF that allows you to build these forms with finer control. Basically taking what is already there for the admin backend and applying it to the frontend. For instance, when creating the field group and fields, having an option down in the “settings” section in the “position” options….”frontend”.
The problem with the position option is that there are a lot of WordPress themes and each of them has a unique code that can prevent the options from working. Maintaining the compatibility between ACF and those themes would be a mess and almost impossible.
ACF is designed as a developer tool, so you have no choice other than modifying the theme files, especially for something complex like your request. I believe you can use a child theme, so you don’t have to worry when the themes have an update. This page should give you more idea about it: https://codex.wordpress.org/Child_Themes.
What you can do is creating a custom shortcode so you can add it in your page builder. But again, you need to modify your theme file or create a new plugin to do it. To create a custom shortcode, please take a look at this page: https://codex.wordpress.org/Shortcode_API.
I’m sorry that I answered your question by referring to those pages. It’s an initial answer before we can go into a deeper topic. That’s because there is a lot of people that doesn’t read the documentation even though the answer is there. Your description also made me assume that you haven’t read those pages. I’m sorry about that.
I hope this makes sense. Thanks!
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!
© 2022 Advanced Custom Fields.