I have an ASP page with a form in it. In the form there is a text input box for an account number. Users can enter multiple account numbers in it and often do. The department using the app wants it to check that only numbers and spaces are in that box. I've got code to check for numbers only, and that works great, but how in the Sam Hill can I get it modified to check for spaces as well. I know Trim will take spaces out of the left or right sides of a value, is there something that will strip them out of a whole string before I pass the value to the vbscript code below for IsNumeric validation?
function AccountCheck
Dim StartAccount
set StartAccount = window.event.srcElement
if StartAccount.value <> "" then
if Not IsNumeric(Trim(StartAccount.value)) then
StartAccount.Style.Color = "#FF0000"
MsgBox "This value must be a numbers only.", 64, "Invalid Account Number"
StartAccount.Focus
else
StartAccount.Style.Color = "#000000"
end if
else
StartAccount.Style.Color = "#000000"
end if
end function
function AccountCheck
Dim StartAccount
set StartAccount = window.event.srcElement
if StartAccount.value <> "" then
if Not IsNumeric(Trim(StartAccount.value)) then
StartAccount.Style.Color = "#FF0000"
MsgBox "This value must be a numbers only.", 64, "Invalid Account Number"
StartAccount.Focus
else
StartAccount.Style.Color = "#000000"
end if
else
StartAccount.Style.Color = "#000000"
end if
end function