talksr
IS-IT--Management
- Nov 2, 2007
- 10
Hello, i have a page working which checks details entered in a user details registration page.
The user has to input among other things such as name, their user id number.
So the form asks for their number:
<p>Your Employee number:
<input type="text" name="emp_no" SIZE="7" MAXLENGTH="7"></p>
Then the js will go through a set of if statements for everything so if nothing is entered for name, return false, which will make a popup show asking for the user to enter the details.
MY QUESTION is how can I get my program to check that the employee number entered is a number?
This is what it looks like at present:
if ( document.employee_details.emp_no.value == "") <!-- if num is also blank (" ") -->
{
alert ( "Please fill in employee number in the 'Your employee no' box." );
valid = false; <!-- If valid is equal to false -->
}
The user has to input among other things such as name, their user id number.
So the form asks for their number:
<p>Your Employee number:
<input type="text" name="emp_no" SIZE="7" MAXLENGTH="7"></p>
Then the js will go through a set of if statements for everything so if nothing is entered for name, return false, which will make a popup show asking for the user to enter the details.
MY QUESTION is how can I get my program to check that the employee number entered is a number?
This is what it looks like at present:
if ( document.employee_details.emp_no.value == "") <!-- if num is also blank (" ") -->
{
alert ( "Please fill in employee number in the 'Your employee no' box." );
valid = false; <!-- If valid is equal to false -->
}