473,387 Members | 1,899 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

make input validating script accept comma?

I've found a useful script that only accepts numbers and a point, and 3
decimals, in an input. But here in denmark we normally use comma as
decimal delimiter in numbers, not the point (.) as in english-speaking
countries.

Can somebody help me making this javascript accept comma as delimiter
in the input? I'm thinking that the best solution is that the script
converts comma to a point, when the user input a comma.

http//sneleopard.dk/test.php

the included script: http://sneleopard.dk/filer/validate2.js

Jan 4 '07 #1
1 2026
In comp.lang.javascript message <11**********************@i80g2000cwc.go
oglegroups.com>, Thu, 4 Jan 2007 02:07:31, hygum <th*********@gmail.com>
posted:
>I've found a useful script that only accepts numbers and a point, and 3
decimals, in an input. But here in denmark we normally use comma as
decimal delimiter in numbers, not the point (.) as in english-speaking
countries.

Can somebody help me making this javascript accept comma as delimiter
in the input? I'm thinking that the best solution is that the script
converts comma to a point, when the user input a comma.
See <URL:http://www.merlyn.demon.co.uk/js-maths.htm#DPV>.

In practice, to get a Number from a control Ctrl,

function DaneRead(Ctrl) { return +Ctrl.value.replace(/,/, '.') }

It's a good idea to read the newsgroup and its FAQ. See below.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6
news:comp.lang.javascript FAQ <URL:http://www.jibbering.com/faq/index.html>.
<URL:http://www.merlyn.demon.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.
Jan 4 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: The Plankmeister | last post by:
Hi... What's the best method of validating input characters? I would like to prevent users submitting exotic characters (such as those acquired on Windows Systems by pressing ALT+) and thought...
21
by: AnnMarie | last post by:
<script language="JavaScript" type="text/javascript"> <!-- function validate(theForm) { var validity = true; // assume valid if(frmComments.name.value=='' && validity == true) { alert('Your...
12
by: SJ | last post by:
Hope someone can help me out there I'm struggling with a particular problem... I have a form with many tab pages. On one tab page I've got a button which when clicked with a mouse adds items...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
8
by: lisaj | last post by:
I'm having huge difficulties producing a script for this: Write a javascript programme that will prompt for, and accept from the user, an input string which contains at least 8 characters. It...
4
by: WB | last post by:
Hi, I need to validate a hidden input in my webform to ensure that it's got value. The controls look something like this: <input id="HidSelectedStates" type="hidden" runat="server" /><br...
5
by: magix | last post by:
Hi, with: <Input type="file"...> it will let the user to click to "browse" button to browse for files, question is how can I limit the file type to be only jpg and gif extension, when the...
12
by: puzzlecracker | last post by:
is it even possible or/and there is a better alternative to accept input in a nonblocking manner?
2
by: babp | last post by:
Hi Iam new to perl and need a help to send inputs to an running application : I am running an application XXXX , and when it starts i am passing a file name called "connect.spb" and after the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.