Pre-populate text field input values from stored values

Good day,

I’m working on my first app.  I want to read various fields from a text file (userName, userAddress, etc.) and put these values into the newTextField input boxes so that the user can either leave them or edit the values and re-save them.  I thought I found the answer on a blog post but the file would not display (xml?).

There is a list of 20 or so of these fields that I need to set up in this way.  This is NOT .placeholder info.

Thank you for any assistance.

To pre-populate a native text field, just create it, then set the ‘text’ value/field to the string/number you want:

local field = native.newTextField( ... ) field.text = "Bob or some other value you want"

OK.  Thanks a bunch.

I thought about just setting the .placeholder value.  Yours looks like a better way.

The placeholder value typically shows with light gray text and as soon as you activate the field, the placeholder disappears.  The .text property is the actual text that’s in the field.

Rob

Thanks, Rob, for that point.

I hope to be ready to test soon.  My next challenge is figuring out how to actually get user to input & save it off.

I appreciate everyone’s help.

To pre-populate a native text field, just create it, then set the ‘text’ value/field to the string/number you want:

local field = native.newTextField( ... ) field.text = "Bob or some other value you want"

OK.  Thanks a bunch.

I thought about just setting the .placeholder value.  Yours looks like a better way.

The placeholder value typically shows with light gray text and as soon as you activate the field, the placeholder disappears.  The .text property is the actual text that’s in the field.

Rob

Thanks, Rob, for that point.

I hope to be ready to test soon.  My next challenge is figuring out how to actually get user to input & save it off.

I appreciate everyone’s help.