Home › Forums › Front-end Issues › acf_form values not updating after Javascript validation › Reply To: acf_form values not updating after Javascript validation
So the way I ended up implementing this was using the acf/validate_save_post
action and removing all Javascript validation. By using acf/validate_save_post
, you can return Javascript errors using acf_add_validation_error('acf[field_4a5c3fe1d1]', 'some error description');
. Notice that you have to use acf[field_id]
in this, you cannot use a post value UNLESS it is an additional field in the front end form. This took a day of debugging and I would love it if the documentation was updated for this use case. For those of you trying this and slamming your head against the wall, just make sure to use acf/validate__save_post
, acf_add_validation_error
, and use the field ID if it is part of the post’s custom fields. Good luck!
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 demoed ACF 6.1 Beta during the most recent session of ACF Chat Fridays, highlighting the new ability to regenerate and clear labels, setting the Admin Menu Parent as a slug, and more. Catch the video replay in our latest summary. https://t.co/rHEpPVas64 pic.twitter.com/hB1XKTexXi
— Advanced Custom Fields (@wp_acf) March 23, 2023
© 2023 Advanced Custom Fields.
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.