Hello, I’d like to know if anyone has figured out how to have more than one acf_form on a page for front end editing.
The site I’m working on, I’ve created a dashboard. From this dashboard page, I’d like to give the user the ability to edit 2 other content items.
I’ve tried registering 2 different forms using acf_register_form(), and it works. My issue is that the html shows errors for duplicate IDs used by the form elements that are generated.
I could use jQuery to change the IDs after the page is rendered, but I’m not sure if that would throw off the form processing or not.
Any help is appreciated, thanks in advance.
You can’t really use two forms that share the same fields on a single page. If these have different
<form> wrappers then you either need to put up with the errors or put the forms on different pages. If they share a
<form> wrapper then the forms will not work and you’ll update both posts with the values in the second occurrence of the fields. The other choice is to create two identical field groups and use one of them for each of the forms.
Hi @hube2 ! I know it’s an old one, but still giving me problems when I use Advanced Forms to display ACF forms in the frontend.
When you say two identical field groups, do you mean that If I was to wrap my fields in a group in both output of my form, they would be perceived by ACF as separate and remove the issue?
I see I see. It’s a simple newsletter subscription form which is displayed in the header / overlay navigation of the website as well as in the footer.
No worries, I’ll resolve the issue by duplicating the form and fields, it’s not a big deal for now and could even actually give us an insight on which of those two gets used the most.
Thanks for replying so quickly! 👍
Actually nevermind. I made further tests and there’s another issue laying around and it still triggers validation for the other forms… basically can’t have multiple forms with required values anyway (which makes sense in the admin, but not on the frontend). I’ll have to resolve the issue differently 🤔
The topic ‘Front end editing, more than one ACF form?’ is closed to new replies.
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!