Skip to Content Skip to Menu

Prevent duplicate value in field

  • kstewart
  • kstewart
  • OFFLINE
  • Posts: 1
  • Thanks: 0
  • Karma: 0
  • Add-ons
1 month 2 weeks ago #344250 by kstewart
Prevent duplicate value in field was created by kstewart
I have a field that is unique to registrants and when they forget their sign-on, they will create a new profile and use the same value in the field. If I had a way of stipulating no duplicates values they wouldn't be able to create another profile. I have CB Query Validation but not sure how to write the validation. The field is called cb_ama and it is a alphanumeric field. Thank you in advance for any help

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 50644
  • Thanks: 8678
  • Karma: 1474
1 month 1 week ago #344258 by krileon
Replied by krileon on topic Prevent duplicate value in field
To validate a field having a non-duplicate value edit your field then navigate to Integrations > CB Query Field > Query Validation and configure the following.

Query Validation: Enabled
Query:
Code:
SELECT `id` FROM `#__comprofiler` WHERE `id` != '[user_id]' `FIELD_NAME_HERE` != '[value]'
Validate On: Empty Results
Error Message: You are already registered.
Ajax Validation: Enabled

Replace FIELD_NAME_HERE with the name of your field. In your case replace it with cb_ama.


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.

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

Moderators: beatnantkrileon
Powered by Kunena Forum