Support

Account

Home Forums Backend Issues (wp-admin) Asynchronous custom field type validation

Helping

Asynchronous custom field type validation

  • Hi,

    I’m developing a new field type for parsing formulas in PHP. I found on this forum how to do client side synchronous validation using the ‘acf/validate_field’ trigger.

    Is there a way to make this async so that I can make an AJAX call to the backend to validate the input? If not, is it possible to validate the field serverside and prevent the save/update when it fails?

    Thanks,

    Laurent

  • Hi @laurent

    ACF v4 uses JS to perform all validation so I can’t offer an easy solution. Good news is that PHP validation is part of ACF v5 (coming soon)!

    For now, you can use the update_value function to run your validation, however you will need to come up with a smart way to save any validation errors to the DB, then on page load, display the errors.

    Sorry,

    Thanks
    E

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

The topic ‘Asynchronous custom field type validation’ is closed to new replies.