RE: Stupid Date Question
Your code tells CF that Day is divided by Month is divided by Year. Use the createDate() function first. You can wrap a try/catch around it. If CF can't create a valid date from your input, then isDate() will throw a catachable exception. Or use isDate(form.day / form.month / form.year) to build your date. M!ke -Original Message- From: Robert Harrrison [mailto:[EMAIL PROTECTED] Sent: Friday, June 15, 2007 3:10 PM To: CF-Talk Subject: Stupid Date Question I validate dates all the time, but in this case I have to combine three separate fields and validate if the date is valid. code is: cfif IsDate(form.day/form.month/form.year) is false BAD DATE /cfif Anyone see what's wrong here. It's not validating. ~| ColdFusion 8 beta â Build next generation applications today. Free beta download on Labs http://www.adobe.com/cfusion/entitlement/index.cfm?e=labs_adobecf8_beta Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:281330 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Stupid Date Question
Did not test it but I think this would work: IsDate(#Form.day#/#form.Month#/#Form.Year#) May need to switch the placement of the day and the month. I personally would use a CreateDate function either within the IsDate function or on a variable that is then used in the IsDate function. On 6/15/07, Robert Harrrison [EMAIL PROTECTED] wrote: I validate dates all the time, but in this case I have to combine three separate fields and validate if the date is valid. code is: cfif IsDate(form.day/form.month/form.year) is false BAD DATE /cfif Anyone see what's wrong here. It's not validating. Robert B. Harrison Director of Interactive services Austin Williams 125 Kennedy Drive, Suite 100 Hauppauge NY 11788 T : 631.231.6600 Ext. 119 F : 631.434.7022 www.austin-williams.com Great advertising can't be either/or... It must be . No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.472 / Virus Database: 269.8.17/850 - Release Date: 6/15/2007 11:31 AM ~| ColdFusion 8 beta â Build next generation applications today. Free beta download on Labs http://www.adobe.com/cfusion/entitlement/index.cfm?e=labs_adobecf8_beta Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:281332 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Stupid Date Question
quotation marks and pound signs? - Original Message From: Robert Harrrison [EMAIL PROTECTED] To: CF-Talk cf-talk@houseoffusion.com Sent: Friday, June 15, 2007 1:09:32 PM Subject: Stupid Date Question I validate dates all the time, but in this case I have to combine three separate fields and validate if the date is valid. code is: cfif IsDate(form.day/form.month/form.year) is false BAD DATE /cfif Anyone see what's wrong here. It's not validating. Robert B. Harrison Director of Interactive services Austin Williams 125 Kennedy Drive, Suite 100 Hauppauge NY 11788 T : 631.231.6600 Ext. 119 F : 631.434.7022 www.austin-williams.com Great advertising can't be either/or... It must be . No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.472 / Virus Database: 269.8.17/850 - Release Date: 6/15/2007 11:31 AM ~| ColdFusion 8 beta â Build next generation applications today. Free beta download on Labs http://www.adobe.com/cfusion/entitlement/index.cfm?e=labs_adobecf8_beta Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:281331 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Stupid Date Question
How about. cfif isDefined(form.Year) and isDefined(form.Month) and isDefined( form.Day) cfif IsDate(CreateDate(form.year,form.month,form.day)) Date Valid cfelse Date is invalid /cfif /cfif On 6/16/07, Robert Harrrison [EMAIL PROTECTED] wrote: I validate dates all the time, but in this case I have to combine three separate fields and validate if the date is valid. code is: cfif IsDate(form.day/form.month/form.year) is false BAD DATE /cfif Anyone see what's wrong here. It's not validating. Robert B. Harrison Director of Interactive services Austin Williams 125 Kennedy Drive, Suite 100 Hauppauge NY 11788 T : 631.231.6600 Ext. 119 F : 631.434.7022 www.austin-williams.com Great advertising can't be either/or... It must be . No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.472 / Virus Database: 269.8.17/850 - Release Date: 6/15/2007 11:31 AM ~| Deploy Web Applications Quickly across the enterprise with ColdFusion MX7 Flex 2 Free Trial http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:281339 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Stupid Date Question
Only one problem with this code cfif isDefined(form.Year) and isDefined(form.Month) and isDefined( form.Day) cfif IsDate(CreateDate(form.year,form.month,form.day)) Date Valid cfelse Date is invalid /cfif /cfif If the data entered into either of the three form fields is invalid, the CreateDate will throw an error before the IsDate can do it's job. It would be better to pull this out into a try catch cftry cfset variables.tempDate = CreateDate(form.year,form.month,form.day) cfcatch type=any cfset variables.dateError = true /cfcatch /cftry On 6/15/07, Andrew Scott [EMAIL PROTECTED] wrote: How about. cfif isDefined(form.Year) and isDefined(form.Month) and isDefined( form.Day) cfif IsDate(CreateDate(form.year,form.month,form.day)) Date Valid cfelse Date is invalid /cfif /cfif On 6/16/07, Robert Harrrison [EMAIL PROTECTED] wrote: I validate dates all the time, but in this case I have to combine three separate fields and validate if the date is valid. code is: cfif IsDate(form.day/form.month/form.year) is false BAD DATE /cfif Anyone see what's wrong here. It's not validating. Robert B. Harrison Director of Interactive services Austin Williams 125 Kennedy Drive, Suite 100 Hauppauge NY 11788 T : 631.231.6600 Ext. 119 F : 631.434.7022 www.austin-williams.com Great advertising can't be either/or... It must be . No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.472 / Virus Database: 269.8.17/850 - Release Date: 6/15/2007 11:31 AM ~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 MX7 integration create powerful cross-platform RIAs http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJQ Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:281345 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Stupid Date Question
very true On 6/16/07, Alan Rother [EMAIL PROTECTED] wrote: Only one problem with this code cfif isDefined(form.Year) and isDefined(form.Month) and isDefined( form.Day) cfif IsDate(CreateDate(form.year,form.month,form.day)) Date Valid cfelse Date is invalid /cfif /cfif If the data entered into either of the three form fields is invalid, the CreateDate will throw an error before the IsDate can do it's job. It would be better to pull this out into a try catch cftry cfset variables.tempDate = CreateDate(form.year,form.month,form.day) cfcatch type=any cfset variables.dateError = true /cfcatch /cftry On 6/15/07, Andrew Scott [EMAIL PROTECTED] wrote: How about. cfif isDefined(form.Year) and isDefined(form.Month) and isDefined( form.Day) cfif IsDate(CreateDate(form.year,form.month,form.day)) Date Valid cfelse Date is invalid /cfif /cfif On 6/16/07, Robert Harrrison [EMAIL PROTECTED] wrote: I validate dates all the time, but in this case I have to combine three separate fields and validate if the date is valid. code is: cfif IsDate(form.day/form.month/form.year) is false BAD DATE /cfif Anyone see what's wrong here. It's not validating. Robert B. Harrison Director of Interactive services Austin Williams 125 Kennedy Drive, Suite 100 Hauppauge NY 11788 T : 631.231.6600 Ext. 119 F : 631.434.7022 www.austin-williams.com Great advertising can't be either/or... It must be . No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.472 / Virus Database: 269.8.17/850 - Release Date: 6/15/2007 11:31 AM ~| ColdFusion MX7 and Flex 2 Build sales marketing dashboard RIAâs for your business. Upgrade now http://www.adobe.com/products/coldfusion/flex2?sdid=RVJT Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:281356 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4