Skip to Content Skip to Menu

Query drop down field - Question

  • AchLive
  • AchLive
  • OFFLINE
  • Posts: 253
  • Thanks: 14
  • Karma: 3
2 years 2 weeks ago - 2 years 2 weeks ago #331507 by AchLive
Query drop down field - Question was created by AchLive
Hi everyone, I have created Query Drop Down fields for the conditional display of Regions, Provinces and Cities. Works fine, no problem. Now I would like to make these fields non-editable by the user when the value of another field is true.
I used this code, in the Layout parameters tab, to make the field immutable
Code:
[cb:if cb_iscrizione_confermata_primo_familiare="Si"][cb_campo_regione_nascita_familiare_001]<div class="hidden">[value]</div>[/cb:if] [cb:if cb_iscrizione_confermata_primo_familiare!="Si"][value][/cb:if]

If the field is not hidden, it correctly displays the value in the list (city region) while if it is hidden, it displays the id number (10).
Requests:
1) Is there an alternative way to the one I used to make fields immutable when a condition occurs in another field? This method I know is not safe and can be bypassed with the right mouse button
2) Is there a way to display the city name instead of its ID when the field is hidden the way I used it?
Thanks for the support
Last edit: 2 years 2 weeks ago by AchLive.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
2 years 2 weeks ago #331514 by krileon
Replied by krileon on topic Query drop down field - Question
[FIELD_NAME] substitutions are always raw output. See our substitution tutorial below on how to use formatted output. Specifically you have to use [cb:userfield field="FIELD_NAME" /], but you cannot use userfield substitutions in a fields own layout as that would create an infinite loop.

www.joomlapolis.com/documentation/279-community-builder/tutorials/18353-using-substitutions-throughout-cb

I recommend just using CB Conditional to turn off the fields profile edit and hide it entirely. Be sure to set its Reset parameter to No so it doesn't reset the fields value when conditioned away. Then be sure to limit your condition to profile edit.


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.

  • AchLive
  • AchLive
  • OFFLINE
  • Posts: 253
  • Thanks: 14
  • Karma: 3
2 years 2 weeks ago #331518 by AchLive
Replied by AchLive on topic Query drop down field - Question
Hi, thank you for your reply.
I tried to use [cb:userfield field="FIELD_NAME" /] , in this case no value is returned, so it doesn't work. I do not need to replace the value of the fields but simply to view the value of the field written in the database as it happens in view profile, where there is no drop-down list but the value is displayed (Region name and not the ID number )

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
2 years 2 weeks ago #331526 by krileon
Replied by krileon on topic Query drop down field - Question
FIELD_NAME needs to be replaced with the name of your field, but again if you're trying to use that in the fields own layout it won't work due to causing an infinite loop, which CB protects itself from. There isn't any functionality for what you're trying to do. Even if you applied this it's purely visual and doesn't block the actual save process. CB Conditional would protect against the save process though.


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.

  • AchLive
  • AchLive
  • OFFLINE
  • Posts: 253
  • Thanks: 14
  • Karma: 3
2 years 2 weeks ago #331532 by AchLive
Replied by AchLive on topic Query drop down field - Question
Thanks for the reply, obviously I replaced FIELD_NAME with my field name
[cb: userfield field = "cb_campo_regione_familiare_001" /] and it doesn't work.
If I write as I indicated in the first post [cb_campo_regione_nascita_familiare_001] it returns the ID of the field and therefore it works even if not in the way I need.
For other fields, text, numbers and dates works fine.
Unfortunately with CB Conditional I can't make it visible and not editable, I can only make it visible or hidden and that's not what I want to achieve.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
2 years 1 week ago #331545 by krileon
Replied by krileon on topic Query drop down field - Question
Are you trying to add that substitution to the layout parameters of cb_campo_regione_familiare_001? As explained above you cannot do that.

Unfortunately with CB Conditional I can't make it visible and not editable, I can only make it visible or hidden and that's not what I want to achieve.

That's very doable with CB Conditional. Create a Custom HTML field that's visible only on profile edit. Place it to be above or below the editable version of your field. Now condition both using CB Conditional. The editable field should be conditioned to hide and the Custom HTML field conditioned to show. Custom HTML fields have no user storage so you can quite literally have as many as you want there's no limits to them so don't be afraid to use them often.


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