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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Masking a Password Input with Astrixes 2

Status
Not open for further replies.

Bystander

Technical User
Sep 4, 2001
112
GB
Hi All,

I have a form that allows the user to key in their password, the field is set so that the input cannot be seen. I really would like to show asterixes so that people can see that they have entered something. Have got by without it for 8 years but really do need to move on.

Please can anyone advise of a solution.

Regards

Bystander
 
Credit to Vlad Menkin.


Code is attached to an unbound field (assume it is named fldPass)
--------------------------------------


var:
stPass string
stAllowablePassChars string

open:
stPass=""
stAllowablePassChars ="123ABCabc"; and so on

keychar:
if stAllowablePassChars.search(eventinfo.char())>0 then
stPass=stPass+eventinfo.char()
fldPass=fill("*",stPass.size())
endif
disabledefault

keyphysical:
if eventinfo.vcharcode()=VK_BACK and stPass>"" then
stPass=stPass.substr(1,stPass.size()-1)
fldPass=fill("*",stPass.size())
disabledefault
endif

-----------------




Mac :)

"There are only 10 kinds of people in this world... those who understand binary and those who don't"

langley_mckelvy@cd4.co.harris.tx.us
 
Bystander,

Vladimir's technique will work, though it hardcodes the password into the code, which makes things harder to maintain over time. (To change the password, you need to change the code.)

You may also wish to take a peek at which shows a different way to do this.

Hope this helps...

-- Lance
 
Lance, unless I'm reading this wrong, the password itself is not hardcoded - only the allowable characters.

Mac :)

"There are only 10 kinds of people in this world... those who understand binary and those who don't"

langley_mckelvy@cd4.co.harris.tx.us
 
Langley and Footpad,

Many thanks for your responses, I have tried both and each is a top class solution. I ended up using the techtricks solution because my password code reads the value in the unbound field.

Lance, shouldn't the line below from your tutorial set the No Echo property to True?

Set fldPassword's Run Time | No Echo property to False by removing its checkmark from the property sheet.

Regards

Bystander
 
Bystandar,

I think you're right. Thank you.

It's a cardinal rule that writers should never serve as their own editors. *sigh*

Sorry...

-- Lance
 
Lance,

Glad to be of service. I spend all day reading code and contracts of employments. Second nature to proof everything I see.

Regards

Bystander
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top