I have set up a Front End ACF form to allow users to register on my site. The basic functionality is all working fine as long as the user registration goes smoothly.
However if there are any issues on the form – such as the user enters an email address already associated with a user account – then I am struggling to handle the error nicely for the user.
At the moment the user is being taken back to the form page and shown the error message I have set up. However – their registration form is empty. As the form is reasonably long it would be nice to be able to pre-populate it with the values they entered as a starting point, but I can’t find any documentation on how to handle this.
Any pointers much appreciated.
You can’t repopulate the form.
Use an acf/validate_value filter for specific fields https://www.advancedcustomfields.com/resources/acf-validate_value/
For example, for the email field you can check existing email addresses. This will create an error message during the validation phase of the form.