I have a form with many optional fields, and I have my SQL
update statement updating the database correctly when radio and
checkboxes are selected. However, when it comes to text boxes, I
can't seem to get my update statement to "skip" them if there is no
value. The fields in the statment below that are text boxes are the
ScanCount and DestroyManDate.
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.
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.
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?
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.