Field Substitution in Profile Layout Rendering Single Quote in a Name Wrong

7 months 2 weeks ago #335037 by bascherz
CB v2.8.1, J! 4.3.4
I sometimes combine fields that are entered separately by the user when displaying them in their profile. In this case, it is the first and last name associated with their phone number. The Profile Value Layout looks like this:

<strong>Phones:</strong><br/>  &#8226; [value] ([formatname])

When [formatname], which I believe is rendered on-the-fly by CB contains a single quote (e.g., D'Angelo), the quote displays like its uninterpreted HTML character code.

Phones:

  • 123-456-7890 (Kyle D&#039;Angelo)

I don't see any way to resolve this myself since there is no PHP or other code here, only substitutions.
Thanks in advance for any assistance.

Regards,
Bruce

______________________
Bruce S - Vienna, VA

Please Log in to join the conversation.

7 months 2 weeks ago #335041 by krileon
Does the formatname field display fine by itself? Seams like an encoding problem. Your database collation maybe set incorrectly. Can also try [cb:userfield field="FIELD_NAME" /] so it will go through normal frontend field processing.


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.
The following user(s) said Thank You: bascherz

Please Log in to join the conversation.

7 months 2 weeks ago #335043 by bascherz
Well, using the [cb:userfield field="BLAH" /] method cleared up the rendering of the quote. However, where that is used now the formatting follows that of the field, whereas just referencing the field directly it does not; you just get the value.

The collation on relevant fields in the database (firstname, middlename, lastname) is utf8mb4_unicode_ci. I believe I recently universally applied that collation to all text fields in all database tables since, up to this point, it resolved problems in other areas. Is there a different one that would work properly here?

Thanks, Kyle.

______________________
Bruce S - Vienna, VA

Please Log in to join the conversation.

7 months 2 weeks ago #335045 by bascherz
OK, I replaced the [formatname] instance with [firstname] [lastname] in the profile view layout and that eliminated the issue. Since [formatname] is an auto-generated pseudo-field, I suspect some issue with how it is being rendered.

I looked more closely and I have profile view and list layouts for the formatname field, both of which use [value] where I want that to appear in the layout. But if I am not mistaken, when using [formatname] directly (not [cb:userfield...]), all I should get is the value. It's in that case that I get the HTML code rendering.

To answer your previous question, formatname renders correctly when used as a list column. It just isn't rendering properly when used in a profile view layout.

In case it matters, my site is on PHP 8.1.

______________________
Bruce S - Vienna, VA

Please Log in to join the conversation.

7 months 2 weeks ago #335063 by krileon
[value] in layouts will output the formatted value of the field. That's working as intended. The only way to get raw field values is with [FIELD_NAME] or [cb:userdata field="FIELD_NAME" /] as our substitution documentation below describes.

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.307 seconds

Facebook Twitter LinkedIn