Validating prompt box or variablse

Discussion in 'JavaScript' started by simon369, Nov 6, 2008.

  1. #1
    I need to be able to validate data that the user enters into a prompt box. This could either be as they enter it and click ok or after once it has been stored into a variable.

    Is this possible at all.

    Also this is my code at the moment

    forename=prompt("Please enter Employees Forename.","");
    surname=prompt("Please enter Employees surname.","");
    employeeno=prompt("Please enter Employees No.","");
    hoursworked=prompt("Please enter hours worked.","");
    payrate=prompt("Please enter pay rate per hour.","");
    nino=prompt("Please enter National Insurance Number.","");
    type=prompt("Please enter F for full time or P for part time.","");
    Code (markup):
    I need each of the validating to numbers, text, certain lengh etc

    Thanks
     
    simon369, Nov 6, 2008 IP