|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
small cfif problem
<!--- output contents of the query--->
<cfoutput query="getids"> <tr> <td>#id#</td> <td>#makeID#</td> <td>#modelID#</td> <td>#AuctionReserve#</td> <td>#bidCount#</td><cfif val(#highestBid#) gt val(#AuctionReserve#)> <td><font color="##FFFFFF">#highestBid#</font><cfelse>#highestBid#</td></cfif> </tr> </cfoutput> above u can see a simple query output into a table. my problem is with cfif, basically if the highestBid is bigger than the reserve price (AuctionReserve) then I want the price (highestbid) in red. For some reason the results disappear in that column... |
|
#2
|
|||
|
|||
|
basically cause FFFFFF is white, but also make sure to match your open/close all your tags or things will disappear as well. Indented format makes everything easier to see. Match your font open close tags, match your td open close tags.
Code:
<td> <cfif val(#highestBid#) gt val(#AuctionReserve#)><font color="red">#highestBid#</font><cfelse>#highestBid#</cfif> </td> |
|
#3
|
|||
|
|||
|
Or you could specify the color in the cfelse & shorten your code up quite a bit:
Code:
<td><font <cfif val(#highestBid#) gt val(#AuctionReserve#)>color="red"<cfelse>color="black"</cfif>>#highestBid#</font></td> It'll work either way, I (personally) just like to keep things like this simple. |
|
#4
|
|||
|
|||
|
Quote:
Really watch how your are running your if statement. Right now, it's set up that when the highest bid is greater than the auction reserver, you are starting a table cell but not ending it. But when the the if statement is not reached, the else part doesn't start a cell but ends the cell. Regardless of the color you are looking for and based on what you are writing it should go as: <cfif val(#highestBid#) gt val(#AuctionReserve#)> <td><font color="##FFFFFF">#highestBid#</font></td> <cfelse> <td>#highestBid#</td> </cfif> OR <td> <cfif val(#highestBid#) gt val(#AuctionReserve#)> <font color="##FFFFFF">#highestBid#</font> <cfelse> #highestBid# </cfif> </td> |
|
#5
|
|||
|
|||
|
amazing replies guys, thank you so much!
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > small cfif problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|