Auto advance to next text field input

Is it possible to auto advance the cursor to the next text field without hitting the “Return” “Enter” key on the keyboard? I need to re-recreate how Apple does its Passcode entry. If the answer is yes, can some one please give me some direction?

Thanks! [import]uid: 8780 topic_id: 24653 reply_id: 324653[/import]

This is a great question, I am glad someone asked it. usually in the web world or desktop apps you watch every character being typed, and when the user reaches the MAX amount of characters entered you set the focus to the next field.

I guess in corona you would setup a listener on the text field.

But I have not done it so dont know if you can.

Larry [import]uid: 11860 topic_id: 24653 reply_id: 99877[/import]

I believe the way to jump fields is by setting the keyboard focus with setKeyboardFocus(). Here is one way to do that.

[code]
– set up a handler for text boxes
function thandler(event)
– user hits enter, handle the text however you like
if event.phase == “submitted” then
something.something
– this phase hits after each new letter is typed
elseif event.phase == “editing” then

– now lets check length of text, if greater than 12
if string.len(event.text) > 12 then

– text is > 12 so lets bump to the next text field
local tid = event.target.id + 1
if tid < 4 then

– we bump by setting the keyboard focus
setKeyboardFocus(tbox[tid])
end
end
end
end

tbox = {}
tbox[1] = display.newTextField(50, 150, 220, 36, thandler)
tbox[1].id = 1
tbox[2] = display.newTextField(150, 250, 220, 36, thandler)
tbox[2].id = 2
tbox[3] = display.newTextField(250, 350, 220, 36, thandler)
tbox[3].id = 3
[/code] [import]uid: 56820 topic_id: 24653 reply_id: 99880[/import]

Thanks @anderoth! This worked like a charm:) [import]uid: 8780 topic_id: 24653 reply_id: 99906[/import]