JRS: In article <cc*************@news.t-online.com>, seen in
news:comp.lang.javascript, Georg Vassilopulos <lu***@NOSPAMweb.de>
posted at Sun, 4 Jul 2004 14:11:03 :
How do I check user input for following formats:
I only want to accept floats or integers written as:
232,45
232
242.45
345
accepted values should be from
100 to 30000 (100.00 - 30000.00)
can anyone help me?
I only need the code inside the checkForm() funktion. The basics are clear.
See <URL:http://www.merlyn.demon.co.uk/js-valid.htm>; I suggest a RegExp
/^[1-9]\d{2,4}([\.,]\d\d)?$/
followed by setting var X = + mycontrol.value
and testing that X <= 3e4 arithmetically.
Checking the upper limit in the RegExp is possible but not reasonable.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> JL / RC : FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.