Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

convert value to String

Status
Not open for further replies.

novice2004

Programmer
Feb 2, 2004
62
0
0
US
How do I convert value from text field to String so I can match it with reg.expresion.
Thank you.


validatePhone(form.elements["phone"].value);


function validatePhone(phone){
phone_array = phone.match(myRE);
 
phone.[red]value[/red]

--Chessbot

"See the TURTLE of enormous girth!"
-- Stephen King, The Dark Tower series
 
If you are calling the function exactly as you say, like this:

Code:
validatePhone(form.elements["phone"].value);

Then your function should work properly. The variable "phone" that is passed in will already be a text string containing the value of the form's phone element.

*cLFlaVA
----------------------------
Lois: "Peter, you're drunk!"
Peter: "I'm not drunk, I'm just exhausted from stayin' up all night drinking!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top