• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Numeric Data Input

New Here ,
Jul 30, 2013 Jul 30, 2013

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! 

Views

482

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jul 30, 2013 Jul 30, 2013

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 30, 2013 Jul 30, 2013

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. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jul 31, 2013 Jul 31, 2013

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation