Bruce,
I would break down the date.  Allowing the user to enter 11/11/2007 is
asking for a lot of validation.

You probably should have a month, day and year input field for each date
range.  This makes it easier to validate.

1/1/1900 is a behavior of SQL Server smalldate field when you send it an
empty string.  If the field is NOT NULL, it will create a rudimentary date.

In your update, you can have conditional logic using <cfif> to only update
the field if you have a valid date when you try to create a date based upon
the three input fields.

Teddy


On 1/24/07, Bruce Sorge <[EMAIL PROTECTED]> wrote:
>
> I have an app that allows a user to enter certain dates about a candidate,
> and not all dates are required. So, what is happening is, if someone
> enters
> the Date Elected, and leaves the other two date fields blank, the date
> 1/1/1900 is entered by default. The form is a Flash Form and I am using
> the
> CFINPUT Type=DateField tag. They look like this:
>
> <cfinput type="datefield" name="DateElected" label="Date Elected"
> width="100" value="#DateFormat(DateElected, "mm/dd/yyyy")#">
> <cfinput type="datefield" name="AppointedDate" label="Date Appointed"
> width="100" value="#DateFormat(DateAppointed, "mm/dd/yyyy")#">
> <cfinput type="datefield" name="ResignDate" label="Date Resigned"
> width="100" value="#dateFormat(ResignDate, "mm/dd/yyyy")#">
>
> Neither of the three are required. So even if I do not enter a date into
> any
> of these fields, I get the default 1/1/1900 entered. Here is the code that
> enters the information:
>
> <cfinvokeargument name="DateElected" value="#Form.DateElected#"/>
> <cfinvokeargument name="AppointedDate" value="#Form.AppointedDate#"/>
> <cfinvokeargument name="ResignDate" value="#Form.ResignDate#"/>
>
> And here is a snipped from the CFC:
>
> <cfargument name="DateElected" type="string" required="no" default="">
> <cfargument name="DateAppointed" type="string" required="no" default="">
> <cfargument name="ResignDate" type="string" required="no" default="">
>
> and the query:
>
> UPDATE tblCouncilMember
>                        SET Fname = '#Arguments.Fname#',
>                            Lname = '#Arguments.Lname#',
>                            Address = '#Arguments.Address#',
>                            City = '#Arguments.City#',
>                            State = '#Arguments.State#',
>                            Zip = '#Arguments.Zip#',
>                            Phone = '#Arguments.Phone#',
>                            Email = '#Arguments.Email#',
>                            Status = '#Arguments.Status#',
>                            NC_ID = #Arguments.NC_ID#,
>                            IssuesOfConcern =
> '#Arguments.IssuesOfConcern#',
>                            DateElected = '#Arguments.DateElected#',
>                            DateAppointed = '#Arguments.AppointedDate#',
>                            ResignDate = '#Arguments.ResignDate#',
>                            TermLength = '#TermLength#'
>                            WHERE CouncilMemberID =
> #Arguments.CouncilMemberID#
>
> Thanks,
>
> --
> Bruce Sorge
>
> "I'm a mawg: half man, half dog. I'm my own best friend!"
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7 
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs 
http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:267492
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to