Field label question...

1 year 4 months ago #331802 by liaskas
Replied by liaskas on topic Field label question...
PM was sent.

Thank you.

Please Log in to join the conversation.

1 year 4 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.
$( '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 to join the conversation.

1 year 4 months ago - 1 year 4 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.
[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.

Please Log in to join the conversation.

1 year 4 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 to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.678 seconds

Facebook Twitter LinkedIn