[#7813] Field Unique

1 month 1 week ago - 1 month 1 week ago #316250 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
1 month 1 week ago - 1 month 1 week ago #316260 by krileon
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 - Templates - CBSubs - Hosting - Forge - Incubator - GroupJive
--
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 EST to 4:00 PM EST. 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.
1 month 1 week ago #316298 by chanteur94
You're right. In fact I use a query to have an unique field.
And your answer resolve my problem.

Thank you.
1 month 1 week ago #316309 by krileon
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 - Templates - CBSubs - Hosting - Forge - Incubator - GroupJive
--
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 EST to 4:00 PM EST. 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.
Moderators: beatnantkrileon
Time to create page: 0.477 seconds

Facebook Twitter LinkedIn