HOWTO: Add custom styling to a field on a DetailView

bsoremsugar —  July 19, 2011 — 8 Comments

Editor’s Note: Picked this tip from the blog of Angel Magafia, author of Implementing SugarCRM 5.x (Packt Publishing – Sept 2010) and a highly proflific Sugar Community member.

Want to make something stand out on the DetailView of your records? Here is a quick way of doing that: add some CSS styling to it.

The best part is that it is very simple to apply this effect.  In order to apply styling to a value (say, to make it show up in red) for a field named interest_c, add the following line to the field’s definition array in detailviewdefs.php stored in custom/modules/Contacts/metadata

'customCode' => '<span style="color: red">{$fields.interest_c.value}</span>',

 

8 responses to HOWTO: Add custom styling to a field on a DetailView

  1. 

    Nice solution but how does it work for checkboxes?

  2. 

    This method does not work. In any case, I failed. Can decipher where the variable is taken and the field.
    I look like this:

    ‘customCode’ => ‘{$GLOBALS.app_list_strings.industry_dom.ne_podkluchen}’,

    after the function field is not displayed.

Trackbacks and Pingbacks:

  1. Bold field - SugarCRM Forums - August 19, 2011

    […] […]

  2. Bold field label - SugarCRM Forums - August 22, 2011

    […] […]

  3. Altering the SugarCRM UI to highlight areas – The Aust Gate - July 22, 2012

    […] to change the field when it is active. This was suggested by Angel Magalafia‘s blog and was reposted by John Mertic. In essence, the post just adds a quick bi of styling to the data in the detail view. To do this, […]

  4. custom tpl file of detail view - October 16, 2012

    […] […]

  5. Customize Layout - February 20, 2013

    […] […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s