Home › Forums › General Issues › How to get a simple form on the front-end
I’m stuck. I want to add a simple form field on the front-end where users can fill in a number. The page where this simple form should appear is already a page (template) where a lot of other ACF Pro fields are present.
I really want this to be handled bij ACF Pro so I can use that number to perform some actions and functions ‘behind the scenes’, so, not just a simple HTML form field (unless someone can tell me how to ‘grab’ entered content in a field before sending or posting…).
There is no need to post or email that form field, I only want to know what data is entered into the field so I can process that.
If anyone is able to tell me how to accomplish this, I would be more than thankful.
Not sure if you already knew this or not, but ACF has a feature to create a front end form. This page should give you more idea about it: http://www.advancedcustomfields.com/resources/create-a-front-end-form/.
If you already know about this feature, could you please explain your objective in more detail?
I was kind of busy lately (good for me), so I didn’t had the time to reply to you.
But to be more specific at my initial question, I’m looking for a way to edit parts of a page/post that is populated with ACF functionality. I don’t intend to create a new post or page, just edit a couple of fields that are, at the time only available on the back-end, to be altered on the front-end.
These edits must be saved, and the result of it must be reflected on the front-end.
In other words: a WP Admin has a numerous of fields to fill out in the back-end for a particular page to be shown at the front-end (for clients).
Some of these fields may never be altered by a client, but must be altered by a WP Admin when things progress.
Now I want to get this WP Admin kept away from the default WP Dashboard, and do his/her changes on the front-end when logged in successfully.
So, when a WP Admin has logged in, he gets a ‘Change parameters’ button on the front-end (he never is redirected to the WP Dashboard). Clicking that button must present him/her with some sort of form to alter the fields he only has access to. And after completing an confirming the changes they are saved to WP and reflected to the front-end for the client.
For example. A Client has requested to buy another 5 items. I want the WP Admin to confirm this on the front-end, so the client sees (on the front-end) he requested for the additional 5 item buy. These items are not bought yet. This is another process following the same principle.
With acf_form(), you can specify the fields you want to edit using the ‘fields’ option. You can also specify the post you want to edit using the ‘id’ option. Please take a look at this page to learn more about acf_form(): http://www.advancedcustomfields.com/resources/acf_form/.
I hope this helps.
I gave myself some ‘time-off’ the coming week and will definitely look into this.
Instead of asking, just learn by doing, so to speak.
I also came across this tutorial (http://thestizmedia.com/front-end-post-editing-with-acf-pro/) and it looks very promising as it covers some of the things I would like to achieve.
Can’t wait to get started!
It’s been a while but I finally got the time to look into acf_form(), and I must admit it’s pretty amazing at what you can do with it.
In fact, I love it!
The fact that you can even call Field Groups on any page you want to collect data is very powerful.
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!
We’re hard at work on ACF 6.1, and Beta 1 is now available 🚀— Advanced Custom Fields (@wp_acf) March 16, 2023
This release includes custom post type and taxonomy registration, an improved experience when selecting field types, PHP 8.1 and 8.2 compatibility, and more!
Let’s take a look 🧵https://t.co/Y0WcAT11l4
© 2023 Advanced Custom Fields.