How to display a variable in a text / label, and conditional. Help!

I have a code where you want to display a label showing the same as embedded in an input.
I think what is missing is the button “send”, but reading the Corona SDK documentation found nothing of the sort. By the way, could you indicate directly that I want to display the variable “myField”?

Take this opportunity to ask if it is possible to call a function from a conditional. Is that possible?
Thank you very much for everything!

This is the code I’m asking at the beginning:

local myField = native.newTextField( 50, 150, 220, 36, handlerFunction )  
myField.inputType = "string"  
local myText = display.newText("", 0, 0, native.systemFont, 12)  
myText:setTextColor(255, 255, 255)  
   
myText.text = myField  
myText.size = 35  
  

[import]uid: 98258 topic_id: 31970 reply_id: 331970[/import]

is this what you’re looking for?
http://docs.coronalabs.com/api/event/userInput/phase.html [import]uid: 70635 topic_id: 31970 reply_id: 127448[/import]

oh, yes!
That was exactly what I wanted!
Thank you very much for your help! [import]uid: 98258 topic_id: 31970 reply_id: 127452[/import]

sorry, one last query. If you would like to add a conditional, for example:
If defaultField equals the text “hello” print “has written a greeting.”

Thank you! [import]uid: 98258 topic_id: 31970 reply_id: 127455[/import]

if defaultField.text == "Hello" then  
 print ("has written a greeting.")  
end  

:wink: [import]uid: 70635 topic_id: 31970 reply_id: 127471[/import]

thank you very much, I needed to put the “.text”
Thanks for your help, I was very useful! :slight_smile: [import]uid: 98258 topic_id: 31970 reply_id: 127473[/import]

is this what you’re looking for?
http://docs.coronalabs.com/api/event/userInput/phase.html [import]uid: 70635 topic_id: 31970 reply_id: 127448[/import]

oh, yes!
That was exactly what I wanted!
Thank you very much for your help! [import]uid: 98258 topic_id: 31970 reply_id: 127452[/import]

sorry, one last query. If you would like to add a conditional, for example:
If defaultField equals the text “hello” print “has written a greeting.”

Thank you! [import]uid: 98258 topic_id: 31970 reply_id: 127455[/import]

if defaultField.text == "Hello" then  
 print ("has written a greeting.")  
end  

:wink: [import]uid: 70635 topic_id: 31970 reply_id: 127471[/import]

thank you very much, I needed to put the “.text”
Thanks for your help, I was very useful! :slight_smile: [import]uid: 98258 topic_id: 31970 reply_id: 127473[/import]