This content has been marked as final. Show 5 replies
Text boxes will always have a value, even if it's an empty string. Trim the value and either check that the result is not an empty string or that it's length is > 0.
....and you really don't need the is True after IsDefined().
I changed that line of code to <cfif len("DestroyManDate")GT 0>DestroyManDate = '#Trim(DestroyManDate)#',</cfif> but it still inserts a value from the text box. What am I missing?
Lucky Kitty wrote:
What am I missing?
That you are testing the length of the string "DestroyManDate" not the
value of a variable of that name, i.e NO QUOTES. I also usually use
trim incase somebody inputs just whitespace characters.
<cfif Len(Trim(destroyManDate)) GT 0>....</cfif>
> <cfif len("DestroyManDate")GT 0>
That checks the length of the literal string "DestroyManDate", not the value of a variable or form field. You probably mean :
<cfif len(DestroyManDate) GT 0>
Though you should trim() and scope your variables.