...

View Full Version : function to detect numbers in form field



allyson
08-05-2002, 12:01 PM
Hi codingforum

I'm working on developing a form where I want to make sure the Street Address field has got a number in the first part of the field.

Can anyone help with this, please?

bye
Allyson

jolietjake
08-05-2002, 12:41 PM
Try this, I suposse it will work:

function detect (text)
{
var firstNumber=text.substr(0,1);
if (parseInt(firstNumber)+""!=firstNumber)
alert ('Needs to begin with a number');
}

Zvona
08-05-2002, 12:54 PM
About number validation :
http://www24.brinkster.com/zvona/htmlexa.asp?article=05

About calculacting form values :
http://www24.brinkster.com/zvona/formCalculate.html



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum