iif() not working right...

Ask a Question related to Macromedia ColdFusion, Design and Development.

  1. #1

    Default iif() not working right...

    I f I do this
    <cfset class = Iif(i mod 2, "lightTableRow", "darkTableRow")>
    I get this
    "Variable lightTableRow is undefined."

    I mean to do this in a short way:

    <cfif i mod 2 EQ 0>
    <cfset class = "darkTableRow">
    <cfelse>
    <cfset class = "lightTableRow">
    </cfif>

    to have table rows lternating in color... Is this the wong approach?

    thanks,

    Marc

    lingo_user Guest

  2. Similar Questions and Discussions

    1. #38816 [Opn]: PHP code that was working perfectly recently stopped working.
      ID: 38816 User updated by: mtoohee at gmail dot com -Summary: PHP code that was working perfectly recently stopped....
    2. Macromedia Flash Player installed and working properly suddenlys stops working..
      No idea what has caused the Flash player to stop working. This is not my machine but a relatives who has asked for help over the T'giving...
    3. div tag not working
      hey guys, im having a little problem with my div tags in dreamweaver 8 ive got 4 div tags for a banner, links content and footer and each of them...
    4. Data not working on Label but is working in Datagrid
      I am creating a simple website in Flex. I want to show different content from the database for home, about us, contact us, etc. I am using a CFC as...
    5. Working TableStyle Not Working on a Second DataGrid
      I am having difficulty getting Tablestyles to work on a datagrid. I have 2 datasets, 1 filled and the other not. The first contains customer, stock...
  3. #2

    Default Re: iif() not working right...

    Ok, I found it should be this:

    <tr class="#IIF(i mod 2, DE('lightTableRow'), DE('darkTableRow'))#">

    problem solved.
    lingo_user Guest

  4. #3

    Default Re: iif() not working right...

    Don't use iif(), I know it is less code but it actually runs slower than cfif.

    See this link about best practices - [url]http://www.macromedia.com/devnet/mx/blueprint/articles/cfbp.html[/url]
    Stressed_Simon Guest

  5. #4

    Default Re: iif() not working right...

    You can use:-



    <tr class="#IIF(i mod 2, DE('lightTableRow'), DE('darkTableRow'))#">

    <tr class="<cfif i MOD 2>lightTableRow<cfelse>darkTableRow</cfif>">
    Stressed_Simon 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