One of our developers here just encountered a situation today where he
was using "_date" in a text field name but had no hidden fields as
mentioned that you would expect to trigger the server-side validation.
Nontheless, the error message was thrown suggesting server-side
validation had taken place.

I've not had time to dig into the issue yet but something odd is
definitely happening.

Ken



-----Original Message-----
From: Dave Watts [mailto:[EMAIL PROTECTED]] 
Sent: Friday, November 22, 2002 4:57 PM
To: CF-Talk
Subject: RE: _date bug in CF5.0, possibly CFMX as well


> Long time ago, I found form field suffix with _date
> would be ignored/unrecognized by CF5.0 either using
> regular FORM submit or CFFORM submit. I may be caused
> by the CFFORM's date type validation and unwittingly
> extended to FORM as well.
> I let it slip for guessing other people would come
> cross it as well and report it, then, Macromedia would
> issue a patch to fix it.  So far, I'ven't heard of
> such a patch.
> 
> No workaround, some database column ends with _date,
> e.g. OrderEntry_Date, which is totally normal and
> common, and one is not supposed to change a given
> database's structure, some one argues that a column
> name should not contain "_" (underscore), I think
> that's nonsense, it does not break any normalization
> rules.
> 
> Folks, correct me, if I'm wrong.

This isn't a bug, and doesn't have anything to do with CFFORM
validation. Within any HTML form, there are some reserved suffixes for
use with CF's built-in server-side validation rules. The suffix "_date"
is one of them. If you name a form field  "dob" (for "date of birth"),
say, and you want to enforce the entry of only date values, you could
add a hidden form to your field called "dob_date":

Date of Birth: <input type="text" name="dob">
<input type="hidden" name="dob_date" value="You must enter a valid date
for date of birth!"> <input type="hidden" name="dob_required" value="You
must enter your date of birth!">

So, again, this isn't a bug. If you design a database schema for use
with a CF application, you may want to avoid the use of field names that
end with "_date" or any of the other six validation rule suffixes. Or,
if you're determined to use those field names, you simply have to deal
with it in your SQL statements:

<cfquery name="UpdStuff" ...>
        UPDATE mytable
        SET    OrderEntry_Date = <cfqueryparam
value="#Form.OrderEntryDate#"
.>
        WHERE  ...
</cfquery>

I'm pretty sure this is listed somewhere within the documentation, as
well.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com

Reply via email to