Ask a Question related to Macromedia ColdFusion, Design and Development.
-
Kamesh192 #1
not showing a field if empty
Hi
I have database query and the results are displayed on a page, now some of the
fields are empty and they take up space.
I wanted to know if anyone here knows any code that WILL NOT display these
empty fields?? so blank white spaces do NOT appear.
any help would be useful.
kamesh
Kamesh192 Guest
-
Make Calculation Field empty not zero
Using Acrobat Pro 6 is there a way to have a calculation field not default to zero 0.00 but rather remain empty? I would like to have it be empty if... -
determine empty field
I have a page that has a timer. Click a button, and the current time is inserted in a field, click another button and the current time is inserted... -
ntext field not showing up (ASP)
I changed the datatype of a field in a SQL Server 2000 database from nvarchar to ntext, but now nothing is being displayed. The "Body" column of... -
CustomControl - Not triggering on an empty field.
Hi, I've made a serverside component that automatically adds a validator. Currently i have both a REQUIRED validator and a CUSTOM validator in... -
Finding Empty Field
When I use the * in a field in a find request to find or omit records that have no data in the field, I get the following error message: This... -
vkunirs #2
Re: not showing a field if empty
Hi Kamesh
If you are using the Table with some TR and TD's then if one column does not
have the value then obviously it will displays the empty space on that place.
or else if you are displaying the values directly on the page then you can
check the length of the each field.
if the length is GT 0 then display the value other wise display nothing.
then you wont get any spaces or something else.
vkunirs Guest
-
Kamesh192 #3
Re: not showing a field if empty
hi
thanks vkunirs.
i am not using tables, the fields are listed on the page serparately.
could you possible tell me where i put "gt 0" for it to affect the query, not
just one field or do i have to put "gt 0" for every field? also do i put "gt 0"
in a <cfif> tag?
sorry, but i am a beginner to all this
below is my code:
<cfoutput>#rsPrint.location#</cfoutput><br>
<br>
<cfoutput>#rsPrint.DESCRIPTION#</cfoutput><br>
<br>
<cfoutput>#rsPrint.short_description#</cfoutput><br>
<br>
<cfoutput>#rsPrint.MINI_IMAGE#</cfoutput><br>
<br>
<cfoutput>#rsPrint.OPEN_TIMES#</cfoutput><br>
<br>
<cfoutput>#rsPrint.LINK1#</cfoutput><br>
<br>
<cfoutput>#rsPrint.LINK2#</cfoutput> <br><br>
<cfoutput>#rsPrint.LINK3#</cfoutput><br><br>
<cfoutput>#rsPrint.SEASONS#</cfoutput><br><br>
<cfoutput>#rsPrint.EVENTS#</cfoutput><br><br>
<cfoutput>#rsPrint.CONTACT#</cfoutput><br><br>
<cfoutput>#rsPrint.INFO_NUMBER#</cfoutput><br><br>
<cfoutput>#rsPrint.XTRA_INFO#</cfoutput><br><br>
<cfoutput>#rsPrint.FACILITIES#</cfoutput><br><br>
<cfoutput>#rsPrint.GRID_REF#</cfoutput><br><br>
<cfoutput>#rsPrint.IMAGE1#</cfoutput><br><br>
<cfoutput>#rsPrint.COST#</cfoutput><br><br>
<cfoutput>#rsPrint.IMAGE2#</cfoutput><br><br>
<cfoutput>#rsPrint.IMAGE3#</cfoutput><br><br>
thanks
kamesh
Kamesh192 Guest
-
PaulH #4
Re: not showing a field if empty
i did one for you:
<cfoutput query="rsPrint">
<cfif trim(len(location))>
#location#<br>
<br>
</cfif>
#DESCRIPTION#<br>
<br>
#short_description#<br>
<br>
#MINI_IMAGE#<br>
<br>
#OPEN_TIMES#<br>
<br>
#LINK1#<br>
<br>
#LINK2# <br><br>
#LINK3#<br><br>
#SEASONS#<br><br>
#EVENTS#<br><br>
#CONTACT#<br><br>
#INFO_NUMBER#<br><br>
#XTRA_INFO#<br><br>
#FACILITIES#<br><br>
#GRID_REF#<br><br>
#IMAGE1#<br><br>
#COST#<br><br>
#IMAGE2#<br><br>
#IMAGE3#<br><br>
</cfoutput>
PaulH Guest
-
Kamesh192 #5
Re: not showing a field if empty
hi
thanks Paul
I put ur code into my page but the problem still exists.
if u look at the page [url]http://www.greengrid.co.uk/printer_friendly.cfm?id=97[/url]
ull see gaps along the page- these are the empty fields.
i dont know if i explained myself clear, basically i dont want empty fields to
be displayed.???
all help welcome!
thanks
kamesh
Kamesh192 Guest
-
PaulH #6
Re: not showing a field if empty
and did you apply that cfif logic to all your fields? and did you include the <br> as well?
PaulH Guest
-
vkunirs #7
Re: not showing a field if empty
Hi
try like this if possible.
<cfoutput query="s">
<cfloop list="#s.columnlist#" index="i">
<Cfif #len(evaluate(i))# gt 0>
#evaluate(i)#<br>
</Cfif>
</cfloop>
</cfoutput>
Here it will check for the each field info and if the field is empty it wont
display anything.
else it will display those info which is in the field.
This works fine for your requirement.
I hope it will works 4 u
vkunirs Guest
-
Kamesh192 #8
Re: not showing a field if empty
hi
thanks paul and vkunirs
it was a upload issue, for some reason the file kept being displayed.
i haved used pauls method and works perfectly.
thanks to both of u for ur help
kamesh
Kamesh192 Guest



Reply With Quote

