How to Save Text Input

I want to do something fairly simple and I’ve looked at a bunch of pages and videos but they’re all about things that are more complicated and I get lost. The app I’m creating does not ask users to create accounts or sign in, etc. Here’s what I want to do:

  • User opens app and navigates to a page where there is a question and a text-input field.
  • User types in their text (perhaps taps a Save button?)
  • Text is saved and reappears on the page in an editable format even if the user has closed the app.

I think this is done with stored variables, but can anyone walk me through how to set this up? Really appreciate it.

Michael

Michael

You’re correct that you need to use a stored variable. I can’t provide a screenshot at the moment but the basic idea is this:

When text input submit (user presses return) or when Save button click:
…Set stored variable to text input’s text.

When screen opens
…If stored variable = null, set stored variable to “”
(this is necessary to prevent crashes due to null variable values)

Design:


Blocks:

I just got this to work like 10 minutes back what a coincidence.

  1. I enter the user info, click the save button. It appears in the list view.
  2. Then I clear it
  3. Then I click restore it is back
  4. I go back to edit mode and exit out of the program and then relaunch the program and this time just click restore pronto the data is back. The “stored” does the magic saving it and restoring.
  5. Please ignore the RestoreLastName text box, that was just for testing.

Hi Tatiang, quick question please. Where does the data actually gets stored? In the Thunkable web server storage or locally in my lap top. If it is indeed in Thunkable web server storage then we should clear it consciously right? Else it might just get filled up. Right? Kindly clarify

2 Likes

Great question and I’ve always assumed it’s stored on the device but I don’t know the details beyond that.

It would be really useful in Design mode and Thunkable Live to be able to see stored data values and also be able to clear that data without the use of blocks.

@anandavardhana57zwwl I’m working on this now and I understand everything you’ve done here except for the line: “set UserlnfoLst’s text items to app variable Listltem”. Not sure why this is necessary - also where did you create “UserInfoLst”? Can you help me out here? Appreciate it.

Michael

They saved each piece of info as a list item. Then they updated a listviewer with the contents of that list. It’s redundant coding because you only need a single set UserInfoList's text items to app variable ListItem at the end. You can also simplify the code by setting app variable ListItem to a list of the five items rather than setting each one individually as a list item.

1 Like

https://x.thunkable.com/copy/6301a09c4b96d8022242fa4e7a6486ab
Hi Michael
Yes Tatiang was right. I did only one and it worked. If I had not tired to help Michael I would not have discovered this bug. As they say help others and you get back dividends. Tatiang thanks for the dividends. Also please note this code is in development so you will find some extra blocks please ignore. Basically I have started to code to validate all fields, I have not tested it, still under development

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.