Open
Description
Description
A highly used feature in ACF is our PHP validation powered via AJAX. This allows developers to highly customize the validation process via PHP whist providing convenient feedback to the user when a field value does not meet its requirements.
To do this, we use JS to intercept the "submit" action on the form and stop it. We then send all $_POST
data via an AJAX request and use the returned JSON to either display errors or re-submit the form.
It is important for UX that we validate the form data only when the user clicks the "publish" button.
Issues
- The form "submit" event is never fired, so our AJAX validation is never triggered.
Questions
- What can we "hook" into to prevent the post from being submit in order to validate via AJAX and then re-submit?
- How can we get all the $_POST data about the post (title, content, etc)?
- How can we re-submit the form after validation is complete?
- Is there an API for displaying an error message in Gutenberg?
Metadata
Metadata
Assignees
Labels
No labels