Text Field Question

I have two screens in my app. On the first screen there is a number. When you click on a button, you are taken to a second screen, where a text field pops up and you are given a native number keypad. Because there is no return key on the keypad, I also have a submit button on the second screen, to take you to the first screen.

I want it so that when a number is entered in the text field, that value is taken back to the first screen and added to the number on the first screen.

Currently when I click the submit button, the number on the first screen doesn’t change, and if I try to go back to the second screen, the app crashes.

here is the code for my second screen:

module(..., package.seeall)  
  
new = function ( params )  
  
 local ui = require ( "ui" )  
  
 local localGroup = display.newGroup()  
  
  
 local addCashField  
  
  
local function addCashHandler(event)  
  
 if ( "submitted" == event.phase ) or ( "ended" == event.phase) then  
 \_G.totalCash = addCashField.text  
 native.setKeyboardFocus( nil )  
 end   
  
end   
   
addCashField = native.newTextField( 50, 150, 220, 36, addCashHandler)  
addCashField.inputType = "number"  
localGroup:insert(addCashField)  
  
local submit = function ( event )  
 if event.phase == "release" then  
 director:changeScene( "mainScreen", "downFlip" )  
 \_G.totalCash = addCashField.text  
 totalCashText.text = "$"..\_G.totalCash  
 native.setKeyboardFocus( nil )  
 end  
 end  
  
local submitButton = ui.newButton {  
 default = "submitButton.png",  
 over = "submitButton.png",  
 onEvent = submit,  
 id = "submitButton"  
 }   
submitButton.x = 75  
submitButton.y = 50  
localGroup:insert(submitButton)  
  
return localGroup  
  
end  

Thanks in advance
-Alex G [import]uid: 7116 topic_id: 17346 reply_id: 317346[/import]

Anybody? [import]uid: 7116 topic_id: 17346 reply_id: 65681[/import]

Tried using a global variable?

\_G.number = 0[/code], on screen two insert the value you want into the global, then back at screen one extract it [code]local nr = \_G.number