Numeric Form Validation

Results 1 to 3 of 3

Thread: Numeric Form Validation

  1. #1
    Join Date
    Dec 1969

    Default Numeric Form Validation

    I have a simple order form with a text box for "quantity." Logically I would like to restrict the entry to only numeric: 1, 2, 3, 4, 5, 6, 7, 8, 9, & 0. (the field can be up to 6 characters long) BUT not allow entry of commas or decimals ... no punctuation, spaces, or alphas too. This is easy to do with JavaScript, only a few lines of code, however I would like to back up the JavaScript with ASP. Is there an easy way to do this with ASP? Only except those 10 characters in the string.<BR><BR>I have tried using the isNumeric function but this allows commas, decimals, dashes,... which I would like to not except. All I want to except is 0 to 9, else an ERROR message. Is there a solution as easy and short as JavaScript offers? Thank you.

  2. #2
    Franco Guest

    Default RE: Numeric Form Validation

    Dude<BR><BR>Like, you have a short and sweet way to do it in JS and you&#039re avoiding it? Hmm...<BR><BR>You could validate a number by using InStr to take out one number at a time with a For Loop (For x= 1 to Len(TestValue)) and testing whether it was 0-9.<BR><BR>Just an idea.<BR><BR>Franco<BR><BR>Insanity can be useful.

  3. #3
    Join Date
    Dec 1969

    Default RE: Numeric Form Validation

    I would use the isnumeric function and theN also use the INSTR function to test for periods and commas.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts