isSecure in TextFields strange behavior

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]

at all i guess i could forget about all…
should i be able to place in the textfield a predefined text like “enter password”
that disappear when the user makes an input and/or the field is not empty :slight_smile:

[import]uid: 4795 topic_id: 15053 reply_id: 55710[/import]

I don’t fully understand your question, but generally speaking:

  1. Create the textfield
  2. Immediately set it to secure to change it into a secure textfield. Don’t try to change it when the user starts typing.
  3. Don’t ever change the secure textfield back. This generally doesn’t make any sense.
    [import]uid: 7563 topic_id: 15053 reply_id: 58536[/import]

i have this exact same user situation and issue, nobody seemed to understand what i was trying to do so nobody replied with anything constructive. you need to use a listener to change the field to is_secure so you can pre-fill the field with legible text “enter password”. Having the field pre-filled with instructions to the user is the new way of doing forms so you don’t need a separate label. it is industry standard now. Ewing sorry but your response does not help resolve the issue of the case that we are trying to use the field for.

One hack solution would be to have another textfield on top of the password field that is a standard text field, and have that field remove itself revealing the password field that is underneath (with is_secure set to true upon setup). This is a hack solution but the only way around it i believe at this point. [import]uid: 6317 topic_id: 15053 reply_id: 66359[/import]

Sorry, this isn’t supported right now. Some native implementations might have placeholder values which is what you really want. We would need to research this to see which platforms support this and then expose this if it made sense. I recommend you file a feature request with us.
[import]uid: 7563 topic_id: 15053 reply_id: 66488[/import]