Copy link to clipboard
Copied
Working on a form to input numeric data. I am using <cfform> and the <cfinput> tags. To help the user with data entry issues I want to show the user the comma format when their data entry goes beyond 3 digits. This should be simple but I can't get this to work. What is correct way to make this happen? On the SQL end it's going into either a DECIMAL(10.2) or an INT.
Thanks!
Copy link to clipboard
Copied
Copy link to clipboard
Copied
This is extreamly helpful. However, I get an odd error on update. It appears the , in the format is throwing off the system.
Error: "[Macromedia][SQLServer JDBC Driver][SQLServer]Incorrect syntax near '111'. "
I don't have a 111 in the data bit when I <cfoutput> the
variables "1,111, 2,222, 3,333, 44,444," Its the comma in figure "1,111" that is causing the issue and appears to be using the comma as a delimiter.
name="ReceivedAfirmation" | |||||||||
value="#numberFormat(ReceivedAfirmation)#" | |||||||||
maxlength="8" | |||||||||
style="text-align:right;" | |||||||||
type="text" | |||||||||
validate="regular_expression" | |||||||||
pattern="/^[0-9]+(\.[0-9]{0,2})?$/" | |||||||||
size="8" | |||||||||
validateAt="onblur" |
Any thoughts on this? Thanks for your help as I am much closer.
Copy link to clipboard
Copied
After re-reading your initial question, I believed you wanted to have a real-time comma placed as user enters numbers. You need to use JS event keyup. Then, bind it to the cfinput.
http://stackoverflow.com/questions/13652931/format-amount-on-keyup