Password Field
Jerry Daniels
mato.kola at wanblizaptan.com
Thu Jan 22 22:09:45 EST 2004
Brian,
I answered this last week for Doug Lerner but maybe my email went
astray or maybe you didn't see it. Here follows an answer to your
question (as well as his)...
************************
Here's one possible way to tackle your question number 2 (password
entry so that you only see asterisks):
1. Make two editable (but empty) text fields called "password" and
"password mask."
2. Hide "password" but keep "password mask" visible for text entry of
the password.
3. Put these handlers into the visible field, "password mask":
on keyDown theKey
--> FIND OUT WHAT'S SELECTED:
put the selectedChunk into theChunk
put word 2 of theChunk into theStartPos
put word 4 of theChunk into theEndPos
--> PUT ASTERISK INTO THE SELECTION IN VISIBLE MASK FIELD:
put "*" into char theStartPos to theEndPos of fld "Password Mask"
--> PUT REAL DATA INTO THE HIDDEN FIELD:
put theKey into char theStartPos to theEndPos of fld "Password"
focus on me
end keyDown
on keyUp
--> GET THAT SELECTION GOING AGAIN:
focus on me
pass keyUp
end keyUp
on backspaceKey
--> IF THEY HIT BACKSPACE...SAME IDEA AS KEYDOWN:
put the selectedChunk into theChunk
put word 2 of theChunk into theStartPos
put word 4 of theChunk into theEndPos
if theStartPos > theEndPos then
put empty into char theEndPos of fld "Password Mask"
put empty into char theEndPos of fld "Password"
else
put empty into char theStartPos to theEndPos of fld "Password Mask"
put empty into char theStartPos to theEndPos of fld "Password"
end if
focus on me
end backspaceKey
on deleteKey
--> IF THEY HIT DELETE...SAME IDEA AS KEYDOWN:
put the selectedChunk into theChunk
put word 2 of theChunk into theStartPos
put word 4 of theChunk into theEndPos
if theStartPos > theEndPos then
put empty into char theStartPos of fld "Password Mask"
put empty into char theStartPos of fld "Password"
else
put empty into char theStartPos to theEndPos of fld "Password Mask"
put empty into char theStartPos to theEndPos of fld "Password"
end if
focus on me
end deleteKey
When you want the password, it will be in the hidden field "password",
not "password mask."
Hope that helps,
Jerry Daniels
On Jan 19, 2004, at 7:08 PM, Brian Maher wrote:
> Hi Folks,
>
> Does anyone have code that they would be willing to share that allows
> a user to enter a password into a text field and visually what they
> enter appears as some other character (blanks, dots, ...)?
>
> Thanks, Brian
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
More information about the use-livecode
mailing list