Setting Default Formatting/Styling of Fields or List Values Within Fields.

4 years 8 months ago #313769 by ernienet
Other than creating a formatted field that embeds formatting for a field, is there a way to set the formatting (styling) for an individual field so that it displays that styling in Lists?

For example, each sponsor may be Bronze, Silver, Gold, or Platinum. I use a field with those names that the administrator assigns to sponsors. The list uses the Sponsor field to display above their business description, but it only shows in plain text.

I was looking for a place where I might be able to style that field in the List, in the Field parameters, or within the individual options for the field, but I could not find a way.

I know how to create a Custom HTML field and wrap formatting around it, but that basically requires the creation of additional fields (more clutter). Is there a way to assign CSS or HTML formatting for individual fields in a List? Even better, would there be a way to assign CSS or HTML formatting to each value in a list field?

Thank you,
Ernie

Please Log in to join the conversation.

4 years 8 months ago #313773 by krileon
You can use the Layout parameters to customize how a field displays. Layouts support substitutions, HTML, and if enabled even Joomla content plugins.


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.

4 years 8 months ago #313782 by ernienet
Ah! It took a little exploring, but I found what you were referring to.

Now, can the [value] have a parameter to specify unique settings? Like <h4 style="color:red";>[value = "Platinum"]</h4>; <h4 style="color:blue";>[value="Gold"]</h4>; etc? (that didn't work, by the way).

in other words, is there a way to embed conditionals?

I'd like to know if all the possible uses of the Parameters might be found.

Please Log in to join the conversation.

4 years 8 months ago #313784 by krileon

Now, can the [value] have a parameter to specify unique settings? Like <h4 style="color:red";>[value = "Platinum"]</h4>; <h4 style="color:blue";>[value="Gold"]</h4>; etc? (that didn't work, by the way).

No, [value] always outputs the full HTML formatted value of a field.

in other words, is there a way to embed conditionals?

Yes, use normal IF substitutions. See our substitutions tutorial below for further usage information. IF substitution examples are at the bottom.

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

If you intend on each having h4 and a color I'd just condition the color only like the below for example.

<h4 style="color:[cb:if FIELD_NAME="VALUE_1"]red[cb:elseif FIELD_NAME="VALUE_2"]blue[/cb:elseif][/cb:if]";>[value]</h4>

Be sure to replace FIELD_NAME with the actual name of your field and VALUE_1/VALUE_2 as needed. You can add as many elseif conditions as you need. If you want a fallback you can do an else instead of elseif to cover generic color cases.


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

Facebook Twitter LinkedIn