I have a field the user is inputting their phone number in and I do not want any dashes. How can I remove dashes if they exist or prompt user to reenter without dashes?
I am using javascript to validate their are no blanks on the form. Where would I place the Replace() code at and is the following the correct format?
Replace(strPhone, "-", " ") I got an error message when I tried this way (not allowed to use parenthesis when calling a sub), so I tried Replace strPhone, "-", " ". I put this code on my Save.asp page, but I noticed that I only passed -1234 instead of the entire number to this form. Let me know how I am screwing this up.
The replace will work fine, though I usually try to avoid the problem all together by creating a separate input for each section of the phone number. Using JS to auto-advance.
Javascript doesn't replace like asp, if you run a replace on a string it will only replace the first occurence. This is an example using regex to replace all occurences and change the value of the text box before submitting the page
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.