Here is a copy of some code i am using, hope this helps… I am using storyboard variables (kind of global(ish)) to keep the value of the textfield.
[lua]local storyboard = require( “storyboard” )
local scene = storyboard.newScene()
local widget = require “widget”
local textField – Forward Reference to the
– Called when the scene’s view does not exist:
function scene:createScene( event )
local group = self.view
local myButton = widget.newButton – button created in before scene moves into view
{
left = 100,
top = 200,
width = 150,
height = 50,
id = “button_1”,
label = “Button”,
onRelease = function(event)
storyboard.description = textField.text – store the value of textfield for later use
storyboard.gotoScene(“storyboard2”, {effect = “slideRight”, time = 600});
end,
}
group:insert(myButton)
end
– Called immediately after scene has moved onscreen:
function scene:enterScene( event )
local group = self.view
local function inputListener( event ) – handler for text field
if event.phase == “began” then
– user begins editing textField
print( event.text )
elseif event.phase == “ended” then
storyboard.description = event.text
– do something with textField’s text
elseif event.phase == “editing” then
end
end
textField = native.newTextField( 20, 60, display.contentWidth - 40, 40 ) – create the textfield once it has moved on stage
textField.text = storyboard.description – get the stored value
native.setKeyboardFocus( textField )
textField.font = native.newFont( “Helvetica-Light”, 18 )
textField:addEventListener( “userInput”, inputListener )
end
– Called when scene is about to move offscreen:
function scene:exitScene( event )
local group = self.view
textField:removeSelf()
end
– Called prior to the removal of scene’s “view” (display group)
function scene:destroyScene( event )
local group = self.view
end
– END OF YOUR IMPLEMENTATION
– “createScene” event is dispatched if scene’s view does not exist
scene:addEventListener( “createScene”, scene )
– “enterScene” event is dispatched whenever scene transition has finished
scene:addEventListener( “enterScene”, scene )
– “exitScene” event is dispatched before next scene’s transition begins
scene:addEventListener( “exitScene”, scene )
– “destroyScene” event is dispatched before view is unloaded, which can be
– automatically unloaded in low memory situations, or explicitly via a call to
– storyboard.purgeScene() or storyboard.removeScene().
scene:addEventListener( “destroyScene”, scene )
return scene[/lua]