Skip to Content Skip to Menu

🌟Discover the Joomla AI Plugin that wrote its own story! - CB Editor Assistant 1.1now for Joomla 3, 4 & 5!
✍️ 5-Day Free Trial, then 🎯 save up to 30% with our 🛍️ Intro Offer (First 50 users, ends Dec. 25th)
🌲 Merry Christmas! Great savings on Professional and Developer Memberships! Get 25% off now with code XMAS-2024!

CB field with CB Conditional shown on and off in edit mode

  • webmasterACA
  • webmasterACA
  • OFFLINE
  • Posts: 60
  • Thanks: 8
  • Karma: 1
  • Add-ons
8 months 3 weeks ago #337620 by webmasterACA
 Hi Support,
I have defined a field in CB, where users can mark they want to join an event. Once 40 people indicated they will join, the field should not be showed anymore as an option.
The field name is cb_badminton_dinner.
The condition is a query that counts the number of people that selected 'Yes' for this choice.
Please find attached a screen shot of the CB Query condition definition.
The weird thing what is happening, is that if a user edits his profile, and selects 'Yes', it is saved to the database. If he displays his CB profile, it is showing as 'Yes'.
If he goes back in edit mode, the field is not shown anymore. After saving, the value of the field is removed in the database and shown accordingly empty in his profile.
If he goes back in edit mode, the field is shown again, he can select again yes or no, and it is stored again. And so on...
All this regardless of the condition of the Query: I am testing in a test environment where I only have access too, and comparing the behaviour after each step with a direct DB SQL.
I really can't figure out what might cause this weird behaviour. Can you please advise.
Attachments:

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48616
  • Thanks: 8302
  • Karma: 1446
8 months 3 weeks ago #337624 by krileon
Set "Reset" to "No" at the bottom below the conditions. That parameter causes a fields value to be reset if the condition is not met. In your case for this field you don't need to have resetting.


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.

  • webmasterACA
  • webmasterACA
  • OFFLINE
  • Posts: 60
  • Thanks: 8
  • Karma: 1
  • Add-ons
8 months 3 weeks ago #337625 by webmasterACA
Setting "Reset" to "No" at the bottom below the conditions does indeed avoid that the field content is removed on the next edit. One part solved.

But once set to yes (or after the initial filling in the form, I don't know really what is the trigger) the field is no longer displayed at any next edit, although the condition to hide it is not met (5 matching records in DB, query definition says less then or equal to 40).
 

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48616
  • Thanks: 8302
  • Karma: 1446
8 months 3 weeks ago #337626 by krileon

But once set to yes (or after the initial filling in the form, I don't know really what is the trigger) the field is no longer displayed at any next edit, although the condition to hide it is not met (5 matching records in DB, query definition says less then or equal to 40).

My guess is one of your conditions might not be correct. Are you sure your query is returning the expected results?

All this regardless of the condition of the Query: I am testing in a test environment where I only have access too, and comparing the behaviour after each step with a direct DB SQL.

I'm not sure what you mean by this. You mean even if there's no conditions the field is hidden after first save?


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.

  • webmasterACA
  • webmasterACA
  • OFFLINE
  • Posts: 60
  • Thanks: 8
  • Karma: 1
  • Add-ons
8 months 3 weeks ago - 8 months 3 weeks ago #337627 by webmasterACA
Yes, I am sure my query is returning the expected result. I using an SQL interface to my DB, copy paste the SQL en run it, it returns '5' which is indeed the number of records matching the query conditions.
I also switched debug on for the field, then I get a message that my condition failed, so the field should not be hided, But nevertheless it is not shown. See attached screenshot.

Second question: sorry for my English. I wanted to say I am using a threshold of 40 records maximum that match my condition. Once 40 records match the condition, the field should not be offered anymore to the user. And I have control of that, since I am the only one who has access to this test environment, both website and DB.

Still I am wondering if my Query is working correctly. I tested again with changing Display option between 'field conditional show' and 'field conditional hide' in the field definition CB conditional tab without changing anything else.
It compares that 5(the query result) is less then 40, but if I switch the definition between 'field conditional show' and 'field conditional hide', it doesn't change anything, in both case the field is not shown. Either of both should show the field, both conditions cannot be true at the same time.

If I use other conditions, I tried 'Does not contain' and 'Not equal to', the field is always shown, which is correct.

If I use the conditions 'Greater then' (5 is not greater then 40), the field is always hidden, both when I set 'field conditional show' and 'field conditional hide'. Which makes no sense to me, in one of both cases the field should be shown.

Same when I use conditions 'Is in' or 'Is less than', the field is never shown, regardless of my choice for hide or show.

Is this information of any use for you?
Attachments:
Last edit: 8 months 3 weeks ago by webmasterACA.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48616
  • Thanks: 8302
  • Karma: 1446
8 months 3 weeks ago #337635 by krileon
Ok, was able to confirm a bug in the JS causing a type casting properly. Have implemented a fix for the type detection so it properly casts now. Your condition was configured properly and was working PHP side of things, but the JS was failing and is why the field kept being hidden.

forge.joomlapolis.com/issues/9395

Please update to latest CB Conditional build release available now and confirm if now working for you.


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