Support

Account

Home Forums Front-end Issues Validation of two fields

Helping

Validation of two fields

    • MatinRz

    • January 15, 2020 at 4:02 am

    Hello friends
    I will illustrate my problem with an example.
    In WordPress I have a custom post type called Mission Definition.
    I defined a mission with the following specifications

    – first name and last name : Matin
    – Mission Start Date: 2020-01-14
    – Mission End Date: 2020-01-20

    And I saved this mission, then I want to make a new one.
    I want no mission in the name of Matin to be saved from date 2020-01-14 to date 2020-01-20 and give an error.

    Thank you for solving my problem.
    I have attached a photo of the fields for you dear friend.
    https://easyupload.io/sk0948

  • You need to create an acf/validate_value (https://www.advancedcustomfields.com/resources/acf-validate_value/) filter. For example you can add the filter on the name field. In the filter you need to get all of the values you are validating on and then do a query to see if there is existing posts with that value. In the past I posted an example of doing this here https://support.advancedcustomfields.com/forums/topic/accept-only-unique-values/#post-45359

Viewing 2 posts - 1 through 2 (of 2 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.