I believe the correct answer here is "both." :-) You absolutely
shouldn't rely only on javascript to check the data that's getting
put into your database. This can be a good way to catch initial
problems (a simple regular expression or use of a validation library
like qForms can catch a lot of stuff IF the user has javascript
enabled), but you must always also validate the data on the server-
side before allowing anything into your database. If you check the
data on the server and can't automatically fix any issues as you
outline or the data fails a regular expression or some other
validation CF can do (the new IsValid() function in CFMX 7 comes in
handy here), then you'd just have to route the user back to the form
and inform them that they need to try again.
Matt
On Jun 18, 2005, at 2:23 PM, Ryan Everhart wrote:
Hey guys,
I just need some feed back on how to treat prices as far as forms and
adding them to the database.
Basically, how do you do it? Right now I have a field in my database
with the data type of MONEY. This field will hold the price of a
property. It seems that the db only like numeric values being added
into that field, which makes sense. So how do you guys validate and
make sure your users put in only numeric values and that they don't
add any $ or , into the form fields? Do you do JavaScript to check
before the form is submitted, or do you just use a ColdFusion Replace
function and remove all invalid characters before they are submitted
to the query?
Thanks,
Ryan
----------------------------------------------------------
To post, send email to [email protected]
To unsubscribe:
http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
To subscribe:
http://www.dfwcfug.org/form_MemberRegistration.cfm
--
Matthew Woodward
[EMAIL PROTECTED]
----------------------------------------------------------
To post, send email to [email protected]
To unsubscribe:
http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
To subscribe:
http://www.dfwcfug.org/form_MemberRegistration.cfm