[#7813] Field Unique

4 years 2 months ago - 4 years 2 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

Please Log in to join the conversation.

4 years 2 months ago - 4 years 2 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.

Please Log in to join the conversation.

4 years 2 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 to join the conversation.

4 years 2 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 to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.206 seconds