input mask for textbox

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
 
D

Daniel M. Hendricks

Brian said:
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..

You might check this out:
http://www.eworldui.net/CustomControls/MaskedTextbox.aspx

Cheers,
Daniel
http://www.danhendricks.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,832
Latest member
GlennSmall

Latest Threads

Top