Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFOUTPUT Date if it is NULL

Status
Not open for further replies.

susanh

MIS
Jan 16, 2001
229
US
Hi everyone,
I am having a serious time remembering if you can do this or not. It has been a while.

Can tell Coldfusion to cfoutput a date field if the table shows that it is NULL?

I define it here
<cfif isdefined("GetProject.duedate") and len(trim(GetProject.duedate))>
<CFSET DueDate="#dateFormat(GetProject.duedate, "MM/DD/YYYY")#">
<cfelse>
NULL
</cfif>

Then <cfoutput> this
<cfinput name="DueDate" type="text" value="#DueDate#" size="10" tabindex="2" class="TextInput" onFocus="setFieldBGColor()" onBlur="resetFieldBGColor()">

But when I view it. I get an Variable DUEDATE is undefined error.

What am I doing wrong?

Thanks
Sue

 
Code:
<cfif isdefined("GetProject.duedate") and len(trim(GetProject.duedate))>
  <CFSET DueDate=dateFormat(GetProject.duedate,'MM/DD/YYYY')>
<cfelse>
  [red]<CFSET DueDate="">[/red]
</cfif>

Hope This Helps!

ECAR
ECAR Technologies

"My work is a game, a very serious game." - M.C. Escher
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top