Results 1 to 8 of 8

Thread: Font color custom fields

  1. #1
    gladiorlic is offline Sugar Community Member
    Join Date
    Nov 2006
    Posts
    12

    Default Font color custom fields

    hi,

    Can someone help me how to change the font color of Custom fields in the Detail View??

    Ive made a Custom Field with a dropdown. i would like to check on a specific value and color the text red.

    regards

  2. #2
    Markku's Avatar
    Markku is offline Sugar Community Member
    Join Date
    Nov 2004
    Location
    Helsinki
    Posts
    910

    Default Re: Font color custom fields

    You probably have to edit modules/modulename/DetailView.html manually.

  3. #3
    pblag's Avatar
    pblag is offline Sugar Community Member
    Join Date
    Jul 2006
    Location
    Ukraine (Chernivtsy)
    Posts
    347

    Smile Re: Font color custom fields

    Quote Originally Posted by gladiorlic
    hi,

    Can someone help me how to change the font color of Custom fields in the Detail View??

    Ive made a Custom Field with a dropdown. i would like to check on a specific value and color the text red.

    regards
    Hi!
    I agree you have to edit the code manually.

    Also i think you need to write javascript code.

    BTW: Please explain more exactly what you need and probably we will help you better.
    Petro Blagodir
    petro@blagodir.ua
    http://www.blagodir.com
    Blagodir Ltd.( SugarCRM - Consultations, Development and Support)

  4. #4
    gladiorlic is offline Sugar Community Member
    Join Date
    Nov 2006
    Posts
    12

    Default Re: Font color custom fields

    Ok.

    We have made a dropdown menu for accounts where we can set the payment history. An option in this list is 'Blacklisted'.
    I would like to make it more clear to our employees when an account is blacklisted. So changing the text color to red (in detailview) would make an improvement.

  5. #5
    Markku's Avatar
    Markku is offline Sugar Community Member
    Join Date
    Nov 2004
    Location
    Helsinki
    Posts
    910

    Default Re: Font color custom fields

    As an example, Accounts have dropdown field "Type", which contains values like Analyst, Competitor, Customer etc. We want to show value Analyst in red and use bold typeface.

    *** added ***
    Note that text is colored in detail view and list view, not in edit view.
    ***

    The dropdown in question is called account_type_dom and can be found in language file include/language/en_us.lang.php. You could edit language file directly the following way:

    Original:
    'account_type_dom' =>
    array (
    '' => '',
    'Analyst' => 'Analyst',

    Changed:
    'account_type_dom' =>
    array (
    '' => '',
    'Analyst' => '<strong><font color="red">Analyst</font></strong>',


    or alternatively create custom/include/language/en_us.lang.php with this content:

    <?php

    $app_list_strings['account_type_dom']=array ( '' => '',
    '' => '',
    'Analyst' => '<strong><font color="red">Analyst</font></strong>',
    'Competitor' => 'Competitor',
    'Customer' => 'Customer',
    'Integrator' => 'Integrator',
    'Investor' => 'Investor',
    'Partner' => 'Partner',
    'Press' => 'Press',
    'Prospect' => 'Prospect',
    'Reseller' => 'Reseller',
    'Other' => 'Other',
    );

    In your case you have to locate file where your custom dropdown values are stored and edit the values manually.

    Hope this helps
    Last edited by Markku; 2007-06-25 at 05:09 PM.

  6. #6
    gladiorlic is offline Sugar Community Member
    Join Date
    Nov 2006
    Posts
    12

    Default Re: Font color custom fields

    Thanks for ur input Markku.

    Ive been playing yesterday with DetailView.html and came up with the following solution.
    Each value is shown in tableDetailView within a span. I gave the span element an id and retrieved the value of this element with getElementById.
    This way i can not only change the color of the text, but for example change the border color of the entire table. (in my case very usefull, because employees need to be alert with these accounts)

    <span sugar='slot13b' id='payment_history'>{PAYMENTHISTORY_C}</span sugar='slot'>

    <script language='javascript'>
    var ph = document.getElementById('payment_history');
    if (ph.innerHTML == 'Blacklisted') {
    var table = document.getElementById('detailtable');
    table.style.borderColor = '#FF3333';
    table.style.borderWidth = '4px';

    ph.style.color='#FF3333';
    }
    </script>

  7. #7
    Markku's Avatar
    Markku is offline Sugar Community Member
    Join Date
    Nov 2004
    Location
    Helsinki
    Posts
    910

    Default Re: Font color custom fields

    Hi gladiorlic,

    Great solution, way more sophisticated than my simple suggestion.

    Thanks for posting it here.

  8. #8
    tobydz is offline Sugar Community Member
    Join Date
    Mar 2011
    Location
    Las Vegas, NV
    Posts
    144

    Unhappy Re: Font color custom fields

    I tried the quick and dirty way above by just editing the en_us.lang.php file in the custom/include folder. Unfortunately, when I view the dropdown, the HTML code is displayed along with it! Any ideas what I'm doing wrong?


    $GLOBALS['app_list_strings']['client_category_list']=array (
    'normal_client' => 'Normal',
    'extremely_important' => '<strong><font color="red">EXTREMELY IMPORTANT</font></strong>',
    'PIA' => 'PIA',
    );

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Custom Fields not saving input data
    By mickster in forum Help
    Replies: 3
    Last Post: 2007-03-08, 01:50 PM
  2. Replies: 3
    Last Post: 2007-02-05, 09:43 PM
  3. Replies: 1
    Last Post: 2006-09-11, 03:38 PM
  4. Adding Custom Fields to a layout (3.5.1)
    By pSouper in forum Help
    Replies: 3
    Last Post: 2006-07-09, 02:10 PM
  5. new added fields don't appear
    By snue in forum Feature Requests
    Replies: 0
    Last Post: 2006-05-08, 08:19 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •