titanium - How to display entered password when click "?" Button -
i using password field in titanium iphone application, need display entered password if user press "?" button , mask password field after release "?" button. used these code
var password = ti.ui.createtextfield ({ font : {fontsize : 15, fonttype: 'havetical tstd', fontweight: 'roman'}, hinttext: "***************", top : 54, left : 107, height : 24, width : 153, passwordmask : true, color : "black", returnkeytype : titanium.ui.returnkey_done, zindex : 5 }); i used touchstart , touchend event showing password, i.e. set passwordmask false when touchstart event occurred , reset true when touchend event occurred.
passwordhintimg.addeventlistener('touchstart',function(e){ passwordtxt.passwordmask = false; }); passwordhintimg.addeventlistener('touchend',function(e){ passwordtxt.passwordmask = true; }); it works when password field blur, if password field focused press "?" button password shown , cannot able hide showed password
finally, got output
i used label showing password , set visible false, when touchstart event occur changed passwordshow label visible true , set password field visble disable, when touchend event occur reset password field visible true , passwordshow label visible false.
var passwordshow = ti.ui.createlabel({ font : {fontsize : 15, fonttype: 'havetical tstd', fontweight: 'roman'}, top : 54, left : 107, height : 24, width : 153, visible : false, backgroundcolor : 'transparent', color : "black", zindex : 15 }); passwordshowvw.addeventlistener('touchstart',function(e){ if(passwordtxt.value.length > 0) { passwordtxt.visible = false; passwordshow.visible = true; passwordshow.text = passwordtxt.value; } }); passwordshowvw.addeventlistener('touchend',function(e){ if(passwordtxt.value.length > 0) { passwordshow.visible = false; passwordtxt.visible = true; passwordshow.text = ''; } });
Comments
Post a Comment