Skip to main content
Participant
July 30, 2013
Question

Numeric Data Input

  • July 30, 2013
  • 1 reply
  • 572 views

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! 

This topic has been closed for replies.

1 reply

p_sim
Participating Frequently
July 31, 2013
Participant
July 31, 2013

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. 

p_sim
Participating Frequently
July 31, 2013

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