How do I capture the text a user enter into a newTextField?

local function handlerFunction(event)
    if event.phase == "submitted" then
        local enteredText = editField.text
        --enteredText now has the value of the text field.
        print(enteredText)
        native.setKeyboardFocus(nil)
    end
end

local editField = native.newTextField( 10, 125, 300, 36, handlerFunction )
--This sets (prefills) the text field value.
editField.text = "some pre-filled text"
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: