Date field (not required) causing an error...Please assist!
Hello, I am a beginner when it comes to ColdFusion could someone please assist with this issue?
I have a date field in my application that is not required, I want users to have the choice to leave this field blank.
Below is a breakdown of what I have going on:
On Add/Edit page:
<cfinvoke component="test"
method="get"
ReferenceNumber="#URL.RefIDNum#"
returnvariable="record">
<cfset ThisIsTheDateField=DateFormat(record.ThisIsTheDateField, "MM/DD/YYYY")>
<cfform action="process.cfm">
<cfinput type="Text"
name="ThisIsTheDateField"
value="#ThisIsTheDateField#"
message="ThisIsTheDateField must be a valid date"
required="no"
validate="date"
validateAt="onSubmit"
size="50"
maxlength="10">
On process.cfm:
<cfinvokeargument name="ThisIsTheDateField"
value="#DateFormat(FORM.ThisIsTheDateField)#">
On CFC Page:
<!--- Method arguments --->
<cfargument name="ThisIsTheDateField"
type="date"
required="no"
hint="ThisIsTheDateField field">
Query Value for this field:
#CreateODBCDate(ARGUMENTS.ThisIsTheDateField)#,
The error I get is:
Error Occurred While Processing Request
The THISISTHEDATEFIELD argument passed to the add function is not of type date.
If the component name is specified as a type of this argument, it is possible that either a definition file for the component cannot be found or is not accessible.
The error occurred in E:/site/test.cfc: line 56
54 :
55 : <!--- Add a record --->
56 : <cffunction name="add"
57 : returntype="boolean"
58 : hint="Add a record">
I need a way to make this field accept blank entries... when I leave it blank I get the above error!
Thank you!
