jstestpager
03-15-2008, 04:53 AM
I have an input named address in a form named customerform and am trying to validate that it contains numbers. But if I were to enter 22222 Pine Way it gives the error message, but 67845 Alfa St would work fine because it has two unique numbers. Why do I need two numbers and how can I change this? Here is the script:
_test_000 = "0"
_test_00 = "1"
_test_01 = "2"
_test_02 = "3"
_test_03 = "4"
_test_04 = "5"
_test_05 = "6"
_test_06 = "7"
_test_07 = "8"
_test_08 = "9"
address_name = document.customerform.address.value
if((address_name.indexOf(_test_000) <= 0) && (address_name.indexOf(_test_00) <= 0) && (address_name.indexOf(_test_01) <= 0) && (address_name.indexOf(_test_02) <= 0) && (address_name.indexOf(_test_03) <= 0) && (address_name.indexOf(_test_04) <= 0) && (address_name.indexOf(_test_05) <= 0) && (address_name.indexOf(_test_06) <= 0) && (address_name.indexOf(_test_07) <= 0) && (address_name.indexOf(_test_08) <= 0)) {
//error message
}
_test_000 = "0"
_test_00 = "1"
_test_01 = "2"
_test_02 = "3"
_test_03 = "4"
_test_04 = "5"
_test_05 = "6"
_test_06 = "7"
_test_07 = "8"
_test_08 = "9"
address_name = document.customerform.address.value
if((address_name.indexOf(_test_000) <= 0) && (address_name.indexOf(_test_00) <= 0) && (address_name.indexOf(_test_01) <= 0) && (address_name.indexOf(_test_02) <= 0) && (address_name.indexOf(_test_03) <= 0) && (address_name.indexOf(_test_04) <= 0) && (address_name.indexOf(_test_05) <= 0) && (address_name.indexOf(_test_06) <= 0) && (address_name.indexOf(_test_07) <= 0) && (address_name.indexOf(_test_08) <= 0)) {
//error message
}