Tutorial example not working for .newTextField

Im following the simple tutorial on youtube to get a feedback response during text input into a .newTextField and I cannot for the life of me get it to work at all. If im being a total idiot feel free to tell me along with the reason it isnt working…

The Feedback response is the part that isnt working. If I put print(“hello”) in the first line of the function before the if statement i get the hello in the simulator terminal, but none of the if statement changes the local lblFeedback so where it should be responding to the event.phases in the function there is no change.

TUTORIAL BEING FOLLOWED:

https://www.youtube.com/watch?v=0z7BVlOjHro

CODE:

local color = require(“plugin.awcolor”)

_W = display.pixelWidth

_H = display.pixelHeight

local background = display.newRect(0, 0, _W, _H)

background:setFillColor(color.fromRGB(247, 155, 51))

local lblFirstName = display.newText(“First Name:”, 100, 80, native.systemFont, 14)

local txtFirstName = native.newTextField(160, 100, 200, 20)

txtFirstName.size = 18

local lblFeedback = display.newText("", 80, 200, native.systemFont, 16)

function txtFirstName:userInput(e)

  if (e.phase == “began”) then

    e.target.text = ‘’

    lblFeedback = “waiting”

  elseif (e.phase == “submitted” or e.phase == “ended”) then

    lblFeedback = "Welcome " … e.target.text

  elseif (e.phase == “editing”) then

    lblFeedback = e.startPosition

  end

end

txtFirstName:addEventListener(“userInput”, txtFirstName)

function background:tap (e)

  native.setKeyboardFocus(nil)

end

background:addEventListener(“tap”, background)

Hi @jrichocean,

Can you please be more specific about what’s not working? Does anything work at all, or is just some aspect of it not working? We can assist you better when we have more information.

Best regards,

Brent

Sorry I updated the OP to be more descriptive as to what is not working. I hope that makes more sense.

Oh, I see, much clearer now. :slight_smile:

You need to change the “.text” property of “lblFeedback” to have its text updated on screen. So, for example:

[lua]

– USE THIS…

lblFeedback.text = “waiting”

– not this…

lblFeedback = “waiting”
[/lua]

Well looks like I need to set up an appt the the optometrist! dang! Thanks Brent!

Hi @jrichocean,

Can you please be more specific about what’s not working? Does anything work at all, or is just some aspect of it not working? We can assist you better when we have more information.

Best regards,

Brent

Sorry I updated the OP to be more descriptive as to what is not working. I hope that makes more sense.

Oh, I see, much clearer now. :slight_smile:

You need to change the “.text” property of “lblFeedback” to have its text updated on screen. So, for example:

[lua]

– USE THIS…

lblFeedback.text = “waiting”

– not this…

lblFeedback = “waiting”
[/lua]

Well looks like I need to set up an appt the the optometrist! dang! Thanks Brent!