Question
CFINPUT with datefield type issue
I have a personal information form that has a hire date entry
field. I would like to make the field optional, yet I have to enter
a hire date as I get an error if I dont. The database autofills the
hire date field with the word "null" so if I submit the form
without entering a date, I get an error message saying: "Error
"null" is an invalud date or time string."
Also, in my database, I have Hire Date as a type DATE, null is selected, and default is 0000-00-00. On a side note, even though I have 0000-00-00 entered as the default, the word "null" still populates the hire date field on the page.
Here is my code:
<cfformgroup type="horizontal" visible="yes" enabled="yes" style="marginLeft:-74;" >
<cfinput type="Datefield" name="HireDate" label="Hire Date:" width="80" bind="{contactList.selectedItem.HireDate}" onchange="UpdateSelect(HireDate, selectYear1);"/>
<cfselect name="selectYear1" width="80" label="" onchange="setStartYear(HireDate, selectYear1);">
<cfoutput>
<option value="">Pick Year</option>
<cfloop index="i" from="1935" to="#thisyear#">
<option value="#i#">#i#</option>
</cfloop>
</cfoutput>
</cfselect>
</cfformgroup>
Any help with this problem would be much appreciated.
Thanks,
Nick Butler
Also, in my database, I have Hire Date as a type DATE, null is selected, and default is 0000-00-00. On a side note, even though I have 0000-00-00 entered as the default, the word "null" still populates the hire date field on the page.
Here is my code:
<cfformgroup type="horizontal" visible="yes" enabled="yes" style="marginLeft:-74;" >
<cfinput type="Datefield" name="HireDate" label="Hire Date:" width="80" bind="{contactList.selectedItem.HireDate}" onchange="UpdateSelect(HireDate, selectYear1);"/>
<cfselect name="selectYear1" width="80" label="" onchange="setStartYear(HireDate, selectYear1);">
<cfoutput>
<option value="">Pick Year</option>
<cfloop index="i" from="1935" to="#thisyear#">
<option value="#i#">#i#</option>
</cfloop>
</cfoutput>
</cfselect>
</cfformgroup>
Any help with this problem would be much appreciated.
Thanks,
Nick Butler
