How can I prevent empty query values from creating empty table cells?

If you place the contents of a ColdFusion query in an HTML table, any blank query value may show up as an empty cell with no borders in the table. This is not a bug in ColdFusion, but rather a result of how the browser renders the a cell that looks like this:


To prevent this, you can check for an empty value and display a non-breaking space instead:

<cfif theValue is "">&nbsp;<cfelse>#theValue#</cfif>

This question was written by Raymond Camden
It was last updated on May 23, 2006.




comments powered by Disqus