Skip to Content Skip to Menu

🌟 CB Editor Assistant 1.0.0 is here! Discover our new AI Joomla Plugin that wrote its story! (and this banner!)
Start at just $12.50/month* or 💸 save 30% with our 🛍️ Intro Black Friday Offer for a lifetime*

[#7813] Field Unique

  • chanteur94
  • chanteur94
  • OFFLINE
  • Posts: 302
  • Thanks: 13
  • Karma: 1
4 years 10 months ago - 4 years 10 months ago #316250 by chanteur94
[#7813] Field Unique was created by chanteur94
Hi
I create a Field Unique but since new version of community builder, the field don't accept an empty fied

How can I keep the possibility to have Field unique even if the field is empty or NULL ?

Thank you
Last edit: 4 years 10 months ago by krileon. Reason: Added [#7813] tag to subject

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48551
  • Thanks: 8291
  • Karma: 1445
4 years 10 months ago - 4 years 10 months ago #316260 by krileon
Replied by krileon on topic Field Unique
Created a field unique? There is no such thing as a unique field. Best you could do is validate it against other fields using code or query validation via CB Code Field or CB Query Field, which wouldn't have anything to do with latest CB release.

CB Code Field and CB Query Field were both improved to always run their validation even if the value is empty as it shouldn't have been skipping validation in that case. Your validation code should take this into account. For example if you don't want query validation being applied to empty values you can condition your query to check for that using an IF substitution. Example as follows.

[cb:if value!=""]QUERY VALIDATION HERE[/cb:if]

Will review just hardcoding this check in, but will need to implement a empty value check depending on the fieldtype since empty is very different depending on the field.

forge.joomlapolis.com/issues/7813


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: 4 years 10 months ago by krileon.

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

  • chanteur94
  • chanteur94
  • OFFLINE
  • Posts: 302
  • Thanks: 13
  • Karma: 1
4 years 10 months ago #316298 by chanteur94
Replied by chanteur94 on topic Field Unique
You're right. In fact I use a query to have an unique field.
And your answer resolve my problem.

Thank you.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48551
  • Thanks: 8291
  • Karma: 1445
4 years 10 months ago #316309 by krileon
Replied by krileon on topic Field Unique
This should already be fixed in latest build available. I've added a fieldtype specific empty check to ensure it doesn't try to validate against empty.


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