freelanceprogrammers.org Forum Index » Cold Fusion
input field as number - format problem
Joined: 01 Apr 2005
Posts: 16
input field as number - format problem
Hi all,
I have an input field that captures a dollar amount, and I`d like users to
use the "1,234,567.00" format. But when they do, the use of the comma
generates this error in CF:
[ODBC Microsoft Access Driver]
Number of query values and destination fields are not the same.
If I enter an amount without a comma, or with a decimal point, there`s no
error. I set my field type in Access to `number` (long integer), then
changed it to `currency` (with 2 decimal places), but the error persists if
I use a comma in the dollar amount. Any ideas/solutions/workarounds to
prevent this?
On a related note, I realize now that anytime I have a field set to
`number` (for instance, an order with amount of items, an area code, etc.),
if the user enters a comma (even if they shouldn`t), I would get the ugly
"...Number of query values..." error message. Any standard way of stripping
any alphanumeric characters when you know there shouldn`t be any but a
given user may enter it by mistake?
Thanks in advance,
Roberto
Joined: 02 Apr 2005
Posts: 20
input field as number - format problem
You could use the Replace function to strip out the commas.
Mark Gregory
----- Original Message -----
From: "Roberto Perez" <rgpg@...>
To: <cold_fusion@yahoogroups.com>
Sent: Saturday, November 12, 2005 5:10 AM
Subject: [cold_fusion] input field as number - format problem
> Hi all,
>
> I have an input field that captures a dollar amount, and I`d like users to
> use the "1,234,567.00" format. But when they do, the use of the comma
> generates this error in CF:
>
> [ODBC Microsoft Access Driver]
> Number of query values and destination fields are not the same.
>
>
> If I enter an amount without a comma, or with a decimal point, there`s no
> error. I set my field type in Access to `number` (long integer), then
> changed it to `currency` (with 2 decimal places), but the error persists
if
> I use a comma in the dollar amount. Any ideas/solutions/workarounds to
> prevent this?
>
> On a related note, I realize now that anytime I have a field set to
> `number` (for instance, an order with amount of items, an area code,
etc.),
> if the user enters a comma (even if they shouldn`t), I would get the ugly
> "...Number of query values..." error message. Any standard way of
stripping
> any alphanumeric characters when you know there shouldn`t be any but a
> given user may enter it by mistake?
>
> Thanks in advance,
>
> Roberto
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
Joined: 01 Apr 2005
Posts: 16
input field as number - format problem
At 09:55 AM 11/12/2005, you wrote:
>You could use the Replace function to strip out the commas.
What about other characters? I`m thinking of points, hashes (to indicate
"no cents"), etc. Is there a standard way to check for different formats,
e.g., "1,000", "1,000.00", "1000.00", "100.-", etc., so that a dollar
amount is converted to a standard format previously to being sent to the
database?
Thanks,
Roberto
Joined: 02 Apr 2005
Posts: 20
input field as number - format problem
You could certainly program your way through that. However, I have found it
usually more practical to simply require at least a basic input formatting
in a case like this. On the form, the user can be shown an example of what
they are supposed to input. Above a price field instead of just putting
"Price" something can be used like "Price (example: 1,234,567.89)".
It really comes down to how far you are willing to go to protect users from
themselves in a way.
Mark Gregory
----- Original Message -----
From: "Roberto Perez" <rgpg@...>
To: <cold_fusion@yahoogroups.com>
Sent: Saturday, November 12, 2005 11:45 AM
Subject: [cold_fusion] Re: input field as number - format problem
> At 09:55 AM 11/12/2005, you wrote:
> >You could use the Replace function to strip out the commas.
>
>
> What about other characters? I`m thinking of points, hashes (to indicate
> "no cents"), etc. Is there a standard way to check for different formats,
> e.g., "1,000", "1,000.00", "1000.00", "100.-", etc., so that a dollar
> amount is converted to a standard format previously to being sent to the
> database?
>
> Thanks,
>
> Roberto
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
Booking Calendar - reservation calendar script
Land Surveying - total station instruments and equipments
China Wholesale - Electronics Products
Character Studio - Tutorials and Help
Booking Calendar - reservation calendar script
Land Surveying - total station instruments and equipments
China Wholesale - Electronics Products
Character Studio - Tutorials and Help







