Home Forums General Issues Add Validation Error Issue


Add Validation Error Issue

  • I’m trying to use acf_add_validation_error, but it doesn’t show the error for the input. Does anyone know how to make this work properly?

    Here is my example:

    acf_add_validation_error( 'first_name', 'Required' );

  • acf_add_validation_error() is not a documented ACF function.

    This is the ACF documentation for adding validation to fields

  • For future reference, this function is referred to here:

    It will work if you use the selector within the input name. Should be something such as acf[field_5b1e124565677].

    acf_add_validation_error( 'acf[field_5b1e124565677]', 'Required' );

  • Thanks @sloconte, after all this time I can still learn something new.

    • Beee

    • August 14, 2019 at 2:28 am

    Thanks @sloconte. Just what I was looking for…

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

You must be logged in to reply to this topic.

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.