Support

Account

Home Forums Feature Requests Validation of a field based on the value of another field Reply To: Validation of a field based on the value of another field

  • Actually, this can be done. I’m in the middle of a project where I needed to validate multiple fields to make sure that a duplicate post is not created.

    ACF passes the value of the field in question but $_POST[‘acf’] contains all of the fields that are submitted. Each index of this array is the field key.

    Using the field key you can get the value submitted in the other field and use it to validate the current field.

    Hope this helps point you in the right direction.

    I’d post my functions but they’d make very little sense in this case because I’m validated 5 fields and I’m validating them against existing posts rather then the value of just one other field.