cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Keep TextInput value when app closes

I have a Textinput field on Screen1 for the user to input their Email Address. However, when the app is closed & re-started the contents of the Textinput field is erased. How can I make the textinput field keep the contents when closed & still allow the user to edit.

Thanks

E

1 ACCEPTED SOLUTION

Accepted Solutions
Memorable Member
Memorable Member

Is this the email of the user opening the app?  If so all you need to do is On Start create a varaible:

 

Set(varEmail,User().Email)

 

Then in the text property of the textinput make it varEmail

View solution in original post

2 REPLIES 2
Memorable Member
Memorable Member

Is this the email of the user opening the app?  If so all you need to do is On Start create a varaible:

 

Set(varEmail,User().Email)

 

Then in the text property of the textinput make it varEmail

View solution in original post

Community Support
Community Support

Hi @Excel_aint,

 

To make data you input in a textinput control always shown in PowerApps, it need to be saved to one of the data sources. And then set the Default property of this TextInput control to the data of this data source. 

 

For example, you can have an Excel table that stored in OneDrive to save the data, then connect this data source to PowerApps. Then in edit  form control, you will be able to see the exsiting data and you can edit it with textinput control inside the edit form. To test and learn, you can start from following below documentation:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/get-started-create-from-data

 

If you mean that you want to temporarily save the data inside textinput control, and still see it in the app next time open the app, then this cannot be achieved so far. PowerApps has variables, but all variables are held in memory while the app is running. After the app closes, the values held in the variables are lost. You can store the contents of a variable in a Data Source using Patch or Collect functions, or in the case of collections you can store to the local device with the SaveData function. Learn about how to create collections and then use SaveData and LoadData function here:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/create-update-collection

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-savedata-loaddata

 

Generally, you can insert a button control, set its OnSelect property to:

ClearCollect(C1,TextInput1.Text);SaveData(C1,"Test")

Then set the Default property of this textinput contro to:

First(C1).Value

Set the OnStart property of this app to:

LoadData(C1,"Test")

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (63,647)