Skip to first unread message

Curly Girlz

unread,
Jun 17, 2017, 12:55:06 AM6/17/17
to MIT App Inventor Forum
Currently trying to finish up a log-in/ register screen for an app. The user registers. Usernames and passwords are stored in a list and the items in the list are then stored in a TinyDB so that when the user re-enters the app they can sign-in with the same username and password they registered with. After clicking register (which prompts app to add usernames/passwords to lists and stores them in Tiny DB), I get an error saying "The operation add items to list cannot accept the arguments: [*empty string*],[bees]" (bees was the username input).  I thought I could fix the problem by verifying that values in the TinyDB are not empty strings, but I see no way to do this. Are there any fix(es) for this problem?
Screenshot 1.PNG
Screenshot 2.PNG
Screenshot 3.PNG
Screenshot4.PNG

Nico Marikucza

unread,
Jun 17, 2017, 5:06:43 AM6/17/17
to MIT App Inventor Forum
There is something wrong with your blocks, see annexes.
Nico
error.png
right.png

Abraham Getzler

unread,
Jun 17, 2017, 2:06:49 PM6/17/17
to MIT App Inventor Forum
You are using global variable logUser in two different ways:

In one place you treat it like a single user name
In another place you treat it like a list of all the user names.

Likewise with the password(s).

Spend a byte or two, they're cheap.

See HOW TO WORK WITH LISTS in this FAQ

Also, make some more global variables, with names reflecting their function, like
NameToPasswordMap, a two column table with name in column 1 and password in column 2,
for use with the list block LOOKUP IN PAIRS.

Also, if you keep a list in TinyDB, never use blank as a default
if not found.  Use CREATE EMPTY LIST instead as a default.

ABG

Reply all
Reply to author
Forward
0 new messages