| Michael Nuwer [dBVIPS] 2005-04-08, 7:01 am |
| Winston Doyle wrote:
> I need users to enter a serial number and then to re-enter, with the second entry matching the first. The second entry must be "invisible" or appear as asterisks to the user. Is there a picture or function property that I am missing?
No, but you can use the following class:
/////// Custom Class: PasswordField ////////////////////////////////
/////// Purpose: Displays "*" and stores value to form.password
/////// andles, delete, backspace and chars only ////
class PasswordField(oFormo
bj) of Entryfield(oFormobj)
this.key = class::PW_Key
function PW_Key(nChar,nPositi
on,bShift, bControl)
pw = iif(type('form.password') # 'C','',form.password)
if nChar = 9 // <tab> or CUAEnter <Enter>
return false
elseif nChar = 8
////// BackSpace
pw = substr(pw,1,nPositio
n-2)+;
substr(pw,nPosition)
xreturn = true
elseif nChar = 127
////// Delete
pw = substr(pw,1,nPositio
n-1)+;
substr(pw,nPosition+
1)
xreturn = true
else
////// Character
pw = substr(pw,1,nPositio
n)+chr(nChar)+;
substr(pw,nPosition+
1)
xreturn = '*'
endif
form.password = pw
return xReturn
endclass
--
Michael Nuwer
http://www.nuwermj.potsdam.edu/dLearn/
http://www.nuwermj.potsdam.edu/dSamples/
|