What does " Cannot read property 'value' of undefined" for a page variable mean?

Hi guys,

I have made a page where people can enter text in an input field. That text then (after clicking a button) is set as a page variable.
Though, for some reason, I cannot enter any value in the input field (when I preview the app), and te console gives me an error saying " Cannot read property ‘value’ of undefined"

Does someone know what to do here?

Hi,

Hmm I guess you’re using the Input field (value) as the value for the page variable? Sounds like there’s a bug with using that, thanks for reporting it, I’ll check it out. Is it possible for you to bind the page variable directly to the input? That should work at least.

On the same page, I have trouble with loading page variables accurately. This should also be part of the bug then?

How do I bind the page variable to the input though?

Yes I would recommend binding page variables straight to the input values if you’re experiencing problems with that. Just set the value property of the input field to the page variable you want to use, like this:

Now anything typed in the input field will get saved to the page variable email.

I already did this, which is exactly why it was strange that I could not even type in the inputfield

Hi, I checked this when looking at your app for another thread, and according to the debugger only one character at a time gets stored in those comment variables… Nothing’s wrong with the setup so I’m guessing that just the amount of variables in the app is causing performance issues. The console is also throwing 501 errors about AllDataPOST and AllDataGET, not sure if that can also cause the weird behaviors. I would consider using data resources and repeat-with structures to implement this app.

Could you elaborate about the last sentence a bit? Totally not familiar with these solutions

What I mean by that is to store every data you have (posts, comments, etc…) in a database instead of writing them in by hand directly to the app in variables. Then the list of e.g. posts can be fetched from the database and displayed in the app, removing the need to use a bunch of variables to hold every piece of information. I recommend you check out the following tutorials about these subjects to get you started:

Core Lesson 3 - Data & Integrations

Repeating Components

Hi Cecilia,

I actually use a REST API to get the variables in the app, so a database should already be in place

Okay good! Then I would suggest you use data variables and object structures for your data, as well as the repeating components linked above to simplify your app and probably get rid of those weird behaviors. Here’s some more resources to check out too:

Working with objects
Lists and repeats