• Resolved Gaby F.

    (@gabyferman)


    Hi, I’m using the latest master version from github and I’m trying to make the Name Field for my ACF form a Unique Field, so i won’t get duplicate clients name on my site, but it’s not working.

    If I use Unique Globally and Unique for Post Type the field gets an error on save, even if it’s a different name. And if I use Post Type->Key it passes even if that name exists.

    Does the fact that is a Front end form makes a difference? Or the unique field does not works for this?

    A little urgent, please help me ??

    https://www.ads-software.com/plugins/validated-field-for-acf/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author doublesharp

    (@doublesharp)

    Just got back into town and checking it out…

    Plugin Author doublesharp

    (@doublesharp)

    Just posted an update with the unique queries fixed, you can grab the latest from https://github.com/doublesharp/validated-field-for-acf/archive/master.zip

    Marking it as resolved but let me know if you still have issues.

    Thread Starter Gaby F.

    (@gabyferman)

    Thanks :), the unique fields are working now.

    I ran some test, it seems that the fields in front end form get validated even if the “Enable Front-End Validation” box isn’t checked, just saying.

    And I’m having some problems with validating emails. I’m using the email field with:
    <?php if ( filter_var( $value, FILTER_VALIDATE_EMAIL ) ) : return true; else : return false; ?> and also
    with preg_match(), with this regex
    /(^[a-zA-Z_.+-]+)@([a-zA-Z_-]+).([a-zA-Z]{2,4}$)/i
    but still i’m being able to pass emails like demo@domain without the .com

    Plugin Author doublesharp

    (@doublesharp)

    You need to refresh the front-end form if you change the front-end validation settings because it is a mixture of client side and server side code. I could probably streamline this in the future, but also keep in mind that some things are built into ACF (like “required”) so changing this plugin’s settings won’t affect that.

    As for the validation, you shouldn’t pass in the / delimiters. This should probably be corrected as well since it’s very confusing, but that said the issue with your pattern is that the . is’t escaped. See this example: https://regex101.com/r/jN3iY4/1

    (^[a-zA-Z_.+-]+)@([a-zA-Z_-]+)\.([a-zA-Z]{2,4}$)

    Thread Starter Gaby F.

    (@gabyferman)

    Ok, thank you for your time and help ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Unique field for a name field’ is closed to new replies.