Forums
This topic is locked
Numbers Only
Posted 13 Sep 2006 17:31:07
1
has voted
13 Sep 2006 17:31:07 Kelly Bell posted:
Hey Everyone.In a Text form, I want to ban every letter apart from numbers . eg. Only Input details (1234567890.) and want to ban letters etc as (abcdefghijklmnopqrstuvwxyz) for the FormatCurrency(rs("Money").
Can anyone help me please?
Replies
Replied 14 Sep 2006 10:44:31
14 Sep 2006 10:44:31 Patrick Woldberg replied:
Serverside you can check the value first with the IsNumeric() function first in ASP.
Clientside you can check with a regular expression in javascript:
<pre id=code><font face=courier size=2 id=code>function checkCurrency(val) {
var re = /^(\d|\.)+$/i
if (!re.test(val)) {
alert('Incorrect currency');
return false;
}
return true;
}</font id=code></pre id=code>
--------------------------------------------------
Patrick Woldberg
Web Developer at Dynamic Zones
Administrator at DMXzone.com, FLzone.net, FWzone.net and DNzone.com
--------------------------------------------------
Clientside you can check with a regular expression in javascript:
<pre id=code><font face=courier size=2 id=code>function checkCurrency(val) {
var re = /^(\d|\.)+$/i
if (!re.test(val)) {
alert('Incorrect currency');
return false;
}
return true;
}</font id=code></pre id=code>
--------------------------------------------------
Patrick Woldberg
Web Developer at Dynamic Zones
Administrator at DMXzone.com, FLzone.net, FWzone.net and DNzone.com
--------------------------------------------------
Replied 15 Sep 2006 07:37:29
15 Sep 2006 07:37:29 Kelly Bell replied:
Cheers mate... you done it again for me
Worked really well. Thank you.
Worked really well. Thank you.