i try to make 2 Password Fields, each with a pre text (“password, or password repeat”, grayed out.
when the user does click a textfield the text color should come black, text empty and isSecure = true
but actually the textfield keeps readable (not secure) when the user clicks the textfield … but
when he does leave it and jumps to my second pwfunction2 it does activate the isSecure for the first textfield?!?!?!
Could anyone please have a look in my source whats wrong with it… also i would be glad should i just need to call one function, but i don’t know how to get in my function form from what formfield the function was called (event.target does not work)
function pwfunction (event)
if event.phase == “began” then
pwField1:setTextColor(0, 0, 0);
– pwField1.text = “”;
pwField1.isSecure = true;
elseif event.phase == “editing” then
pwField1.isSecure = true;
elseif event.phase == “ended” then
if pwField1.text == “” then
pwField1:setTextColor(155, 155, 155);
pwField1.text = “Password repeat”
pwField1.isSecure = false;
end
end
end
function pwfunction2 (event)
if event.phase == “began” then
pwField2:setTextColor(0, 0, 0);
–pwField2.text = “”;
pwField2.isSecure = true;
elseif event.phase == “editing” then
pwField2.isSecure = true;
elseif event.phase == “ended” then
if pwField2.text == “” then
pwField2:setTextColor(155, 155, 155);
pwField2.text = “Password repeat”
pwField2.isSecure = false;
end
end
end
pwField1 = native.newTextField( 50, 150, 680, 60, pwfunction )
pwField1.inputType = “default”
pwField1.text = “Password”
pwField1:setTextColor(155, 155, 155);
pwField1.isSecure = false
localGroup:insert(pwField1)
pwField2 = native.newTextField( 50, 250, 680, 60, pwfunction2 )
pwField2.inputType = “default”
pwField2.text = “Password repeat”
pwField2:setTextColor(155, 155, 155);
pwField2.isSecure = false
localGroup:insert(pwField2)
thx chris [import]uid: 4795 topic_id: 15053 reply_id: 315053[/import]