Skip to Content Skip to Menu

Field label question...

  • liaskas
  • liaskas
  • ONLINE
  • Posts: 391
  • Thanks: 36
  • Karma: 2
  • Add-ons
1 year 11 months ago #331802 by liaskas
Replied by liaskas on topic Field label question...
PM was sent.

Thank you.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
1 year 11 months ago #331804 by krileon
Replied by krileon on topic Field label question...
You're using a radio field. My example was for a select field. Below is an example that will work with radios/checkbox type fields.
Code:
$( 'input[name="FIELD_NAME_1"]' ).on( 'change', function() { if ( $( this ).val() === 'company' ) { $( '#cblabFIELD_NAME_2' ).html( 'Company' ); } else { $( '#cblabFIELD_NAME_2' ).html( 'Name' ); } });


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.

  • liaskas
  • liaskas
  • ONLINE
  • Posts: 391
  • Thanks: 36
  • Karma: 2
  • Add-ons
1 year 11 months ago - 1 year 11 months ago #331817 by liaskas
Replied by liaskas on topic Field label question...
Ok... the auto action worked great! Thank you.

Now we deal with the language file conditioning. The following (that you suggested in a previous post of yours) works great.

[cb:if cb_registeras="Person"]First and Last Name[cb:elseif cb_registeras="Company"]Company Name[/cb:elseif][cb:else]Name / Company[/cb:else][/cb:if]

But we need more conditioning. We need to condition like bellow...

[cb:if cb_registeras="Person"]First and Last Name[cb:elseif cb_registeras="Company"]Company Name[/cb:elseif][cb:elseif reason="search"][cb:if url contains "userlist-companies"]Search for Companies by name[cb:elseif url contains "userlist-individuals"]Search for Individuals by name[/cb:elseif][/cb:if][/cb:elseif][/cb:if]

but when we use it, the label disappears from registration page. It shows pretty fine on all the other pages.

Is there a reason that explains the fact that the label disappears when we expand the conditioning to (reason=search) or (url contains...) ?

Is there a case that we have a conflict between these types of conditioning and the auto action jquery?

EDIT...

I think i have spoted the problem.

Logically the jquery searches the language file before it does anything. There (with the substitutions we used before, there is no reference to the registration page, so the label for field "name" was not showing at all.

We added one more condition to the language string and it became like this.
Code:
[cb:if user_id="myid"] [/cb:if] [cb:if cb_registeras="Person"]First and Last Name[cb:elseif cb_registeras="Company"]Company Name[/cb:elseif][cb:elseif reason="search"][cb:if url contains "userlist-companies"]Search for Companies by name[cb:elseif url contains "userlist-individuals"]Search for Individuals by name[/cb:elseif][/cb:if][/cb:elseif][/cb:if]

Now it works pretty fine.

Do not know if the above code may cause any issues. Any suggestions are pretty much appreciated.
Last edit: 1 year 11 months ago by liaskas.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
1 year 11 months ago #331828 by krileon
Replied by krileon on topic Field label question...
Don't nest cb:if within cb:if use cb:elseif. Example as follows.

FROM: [cb:elseif reason="search"][cb:if url contains "userlist-companies"]
TO: [cb:elseif reason="search" and url contains "userlist-companies"]

You also don't have a fallback value for when all of your condition checks fail. Which they will during registration since the registration user has no values yet. Use [cb:else] to cover such a case. Examples are provided in our substitution tutorial below.

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


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