Skip to Content Skip to Menu

check for duplicates

  • azjr
  • azjr
  • OFFLINE
  • Posts: 99
  • Thanks: 10
  • Karma: 2
9 years 2 months ago - 9 years 2 months ago #270024 by azjr
Replied by azjr on topic check for duplicates
Reg: the phone validation:

krileon wrote: The query validation is per field. So if you want to validate your phone field you need to edit your phone field in CB > Field Management then add query validation specifically for it. Example as follows.


I'm not sure if I understand. The problem as I see it:
each field has two possible validations: 1) PERL regex and 2) CB QUERY FIELD
I'm using PERL regex to validate against the proper phone input, forcing only the format: (999) 999-9999 and CB QUERY to validate against possible duplicate values.

The fields will validate correctly (in respect to each validation) with ONLY ONE ACTIVE QUERY - either the PERL (custom regex) or CB QUERY

If I try to turn both queries - nothing happens and I can't save the record.

Are you saying, or should I understand that each field can only validate one query?
Please advise if there is a way to validate the field as in above scenario - thanks!

~~~
CORRECTION:
hmm... :unsure: I was under impression that my regex is correct (tested here: regex101.com/#pcre ):
Code:
/^[\(](?<area>\d{3})[\)][ ](?<group1>\d{3})[-](?<group2>\d{4})\W*?$/
... and woud swore that it worked in front-end when tested (interestingly, I have observed, that if I test the form logged in the front-end as super-user, all works fine, BUT once I started testing it in the back-end, I noticed the issue...)

so maybe the issue is in the regex not being written correctly (?) so if regex would have validate, the whole problem has nothing to do with the two validation running on the same form (?) - hmmm.... any thoughts? thanks!
Last edit: 9 years 2 months ago by azjr.
The following user(s) said Thank You: krileon

Please Log in or Create an account to join the conversation.

  • azjr
  • azjr
  • OFFLINE
  • Posts: 99
  • Thanks: 10
  • Karma: 2
9 years 2 months ago #270025 by azjr
Replied by azjr on topic check for duplicates

azjr wrote: Reg: the phone validation:
CORRECTION:
hmm... :unsure: I was under impression that my regex is correct (tested here: regex101.com/#pcre )...
... so maybe the issue is in the regex not being written correctly (?)


OK - I got it: it was the custom regex.
the PERL regex that works and forces the phone entry in the format "(999) 999-9999 (for US phone##) AND WORKS with the CB QUERY field:
Code:
/^([\(][0-9]{3}[\)][ ]([0-9]{3})[-]([0-9]{4}))$/

I have proven (maybe just to myself :P and the hard way) that indeed both PERL and CB QUERY can work well together without conflict (tada!)
Now, let's go skydiving... enough time in front of computer - happy Labor Day to those in the US!
The following user(s) said Thank You: krileon

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48536
  • Thanks: 8290
  • Karma: 1445
9 years 2 months ago - 9 years 2 months ago #270090 by krileon
Replied by krileon on topic check for duplicates

after user provides the email (the required one), there are 3 more email fields (optional): email2,email3,email4 - so if user attempts to enter the same email address into any of those fields, user should get the error validation.

CB Query Field can't help with that as nothing has been stored yet. You'd need a custom jQuery validate rule to be testing for that or just some custom jQuery in general.

You could use CB Auto Actions and its Code action to add jQuery to the before registration from trigger then write some jQuery to make sure they don't fill in your email fields with a value they've already supplied to the others.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
Last edit: 9 years 2 months ago by krileon.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum