If something EQ to value then apply a style

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default If something EQ to value then apply a style

    There is probably a simple solution to this, but after much searching I haven't
    found much info...

    I have a table with rows where values can be either 'Goal' or a 'Strategy'.
    If the record returned is 'Goal', then I want to apply a bold style to those
    rows. Is this possible? Something similar to the following (I know my syntax
    is wrong):

    <cfset strong_css_class = If (GOAL_STRATEGY EQ Goal, styleclass="bold")>

    <td
    class="#strong_css_class#">#DivisionsGoalsStrategi es.GOAL_STRATEGY#</td>
    <td>#DivisionsGoalsStrategies.GOAL_TEXT#</td>
    <td>#DivisionsGoalsStrategies.GOAL_IDENTIFIER#</td>
    <td>#DivisionsGoalsStrategies.GOAL_CREATE_BY#</td>

    Basically my question is if you can apply a CSS style dynamically to a column
    or row if a certain condition is met... and how I would go about doing that.
    Thanks.

    Hi There Guest

  2. Similar Questions and Discussions

    1. Can I apply Optical Margin Allignment through a Paragraph Style?
      I can't find a way to make Optical Margin Alignment part of a certain paragraph-style. I'm now clicking a text frame from any story to apply it. ...
    2. How do I apply a keyboard shortcut to None character style
      I have looked everywhere that I can think of, but can't figure out how I can apply a keyboard shortcut to the 'None' character style; can it be done?...
    3. Apply css style to table cell?
      Is there a way to apply a css style to a table cell? I have a style that creates a dotted line on the top border and needs to be applied to a cell...
    4. Need help with Style conversion from Style object to Style key/value collection.
      I am writing a custom control that derives from the DataGrid control. I would like to apply SelectedItemStyles and ItemStyles for use in my derived...
    5. Number format German style => English style when importing CSV files into MySQL-DB
      Hi there, I'm trying to import a csv file into my MySQL database. Unfortunately the number format for the price column is formatted in German...
  3. #2

    Default Re: If something EQ to value then apply a style

    You have answered your own question????
    Stressed_Simon Guest

  4. #3

    Default Re: If something EQ to value then apply a style

    How simple. That worked!
    I'm relatively new to CF, so sometimes I think things are going to be more
    complicated than they need to be...
    Thanks.

    ---------

    I also got my origianal idea to work too, but with some changes in the syntax:

    <CFSET strong_css_class = IIF(DivisionsGoals.GOAL_SIMPLE_TYPE EQ 'Goal',
    "'Style1'", "'Style2'")>

    <td class="#strong_css_class#">#DivisionsGoalsStrategi es.GOAL_STRATEGY#</td>
    <td>#DivisionsGoalsStrategies.GOAL_TEXT#</td>
    <td>#DivisionsGoalsStrategies.GOAL_IDENTIFIER#</td>
    <td>#DivisionsGoalsStrategies.GOAL_CREATE_BY#</td>

    This applies Style1 from my linked css to the cell if the returned value is
    'Goal', and applies Style2 if the value is not = 'Goal'.

    Hi There Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139