B
Brian Ciarcia
Can someone please look at the following code that I have been using for
my asp forms and help me convert it so that I can use it on my .net
forms?? I have tried using the maskedit control and kept getting an
activeX error. I have also tried downloading the flexmaskedit and
validtext controls, but when I add them to my toolbox, they are greyed
out..
--------------------------------------------------------
function fp(Phone)
dim phoneStr
phoneStr = window.document.form1(Phone).value
pString = phoneStr
dim tempString
tempString = replace(pString," ","")
tempString = replace(tempString,"(","")
tempString = replace(tempString,")","")
tempString = replace(tempString,"-","")
tempString = replace(tempString,".","")
tempString = replace(tempString,"X","x")
if (instr(tempString,"x")) then
on error goto 0
tempString2 = split(tempString,"x",-1)
select case len(tempString2(0))
case 10
fp = "(" & left(tempString2(0),3) & ") " &
right(left(tempString2(0),6),3) & "-" & right(tempString2(0),4)
case 7
fp = left(tempString2(0),3) & "-" & right(tempString2(0),4)
case else
msgbox ("Please put the phone/fax number the following format
(###) ###-#### x####")
end select
window.document.form1(Phone).value = fp & " x" & tempString2(1)
else
select case len(tempString)
case 10
fp = "(" & left(tempString,3) & ") " & right(left(tempString,6),3) &
"-" & right(tempString,4)
case 7
fp = left(tempString,3) & "-" & right(tempString,4)
case else
msgbox ("Please put the phone/fax number the following format
(###) ###-####")
end select
window.document.form1(Phone).value = fp
end if
end function
my asp forms and help me convert it so that I can use it on my .net
forms?? I have tried using the maskedit control and kept getting an
activeX error. I have also tried downloading the flexmaskedit and
validtext controls, but when I add them to my toolbox, they are greyed
out..
--------------------------------------------------------
function fp(Phone)
dim phoneStr
phoneStr = window.document.form1(Phone).value
pString = phoneStr
dim tempString
tempString = replace(pString," ","")
tempString = replace(tempString,"(","")
tempString = replace(tempString,")","")
tempString = replace(tempString,"-","")
tempString = replace(tempString,".","")
tempString = replace(tempString,"X","x")
if (instr(tempString,"x")) then
on error goto 0
tempString2 = split(tempString,"x",-1)
select case len(tempString2(0))
case 10
fp = "(" & left(tempString2(0),3) & ") " &
right(left(tempString2(0),6),3) & "-" & right(tempString2(0),4)
case 7
fp = left(tempString2(0),3) & "-" & right(tempString2(0),4)
case else
msgbox ("Please put the phone/fax number the following format
(###) ###-#### x####")
end select
window.document.form1(Phone).value = fp & " x" & tempString2(1)
else
select case len(tempString)
case 10
fp = "(" & left(tempString,3) & ") " & right(left(tempString,6),3) &
"-" & right(tempString,4)
case 7
fp = left(tempString,3) & "-" & right(tempString,4)
case else
msgbox ("Please put the phone/fax number the following format
(###) ###-####")
end select
window.document.form1(Phone).value = fp
end if
end function