Support

Account

Home Forums ACF PRO acf_reset_validation_errors() does not work on front end forms.

Solved

acf_reset_validation_errors() does not work on front end forms.

  • I need to be able to conditionally skip validation on a front end form.

    The documenation states that you can use a combination of acf/validate_save_post and acf_rest_validation_errors() to conditionally skip validation, but acf_reset_validation_errors() isn’t respected by acf_form().

    Thanks for any help,

  • I’ve additionally tried circumventing validation using

    add_filter(‘acf/validation_value’, __return_true());

    This doesn’t seem to work for required fields on the acf_form as well.

  • In 5.7.0-beta3 I’m able to disable the javascript validation by changing the value of acf.validation.active to false.

    This combined with acf_reset_validation_errors() allows me to submit incomplete forms conditionally, ignoring required fields.

  • This seems like a bug… I’ve been trying to do the same thing for 2 days using the documentation and seeing the same as the above.

    How did you set the value of acf.validation.active? Is this done in your function hooked to the acf/validate_save_post action?

  • acf.validation.active is a javascript variable so you need to change it with javascript.

  • My apologies!

    So, although I have done those JS measures, what I can also should do is use the hook

    acf_reset_validation_errors();

    I can do this based on a query string which means if the form is save for later – it does not validate, but if I want to fully submit, we run validation.

    I get it now!

    acf_reset_validation_errors() is pretty powerful in this situation.

    NK

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘acf_reset_validation_errors() does not work on front end forms.’ is closed to new replies.