Sending empty text box cause error on firebase

I made a way that helps my users to give me feedback messages that I receive on the firebase realtime database.

my problem is:

if I leave the text boxes empty and press send, I have everything erased on the firebase like if there is an error

This is my block build
1231

This when my data color turns red before being erased.
12311

I know it may be simple but I’m new :slight_smile:

last thing: how can i make the notifier work to give the user a notice " message sent"

notifier problem solved but the “erasing issue” still exists

You can't put a value in a tag that has sub tags. If you do, all the sub tags will be removed.

You can either have:

tag:value

or

tag
|- subtag:value
|- subtag:value

but you cannot have

tag:value
|-subtag:value
|-subtag:value

i’m afraid i don’t follow u :’( can u give me the short answer plz :smiley:

what should i put in the block page to make one of the following conditions:

1- the send button is invisible if there isn’t a text in BOTH text boxes.
2-the send button won’t work and ask them to fill BOTH text boxes in order to send the message.

have being trying to solve this for the last 3 hours :smiley:

just got an idea… if i can make the “name” text box call a random number from 1 to 1000 without repeating the same number twice as if it’s the name… then my problem is solved or m

That was the short answer!

Think about it another way:

You have a tag in your firebase database. This tag can have a value. The value can either be a simple number or string(e.g. 1 or 0 or true or banana), or it could be an array of values (list of things or a series of subtags with values).

If you change the value of your tag, then all data in that tag’s value will be changed, whether it is a simple number or string or an array of values or a series of subtags

I solved the problem of " sending empty text bot cause error on firebase" but i’m having another problem which i think you my dear friend are talking about which is " if someone choose the same name that someone picked before then my data (from the older person) will be changed to the data of the newer person.

by the short answer i mean what should i have in the blocks, i’m not good at English so there is some things i don’t really understand.

To prevent that from happening, you will need to keep a record of all the tags on the database, when a user enters a tag to be saved, this needs to be checked against your list of existing tags, and refused if it exists.

1 Like

U think this list thing will work?1112

sorry i know i have a lot of questions :smiley:, how do i keep a record of all tags on database?

if its hard then i got another idea… i’ll make 2 “call (firebaseDB)” one for their name and one for their message and each has his own tag but i need to link the name to the message with some way which is " i get a time notice on the firebase hh:mm" but the question is

how?

u know what! i’ll make it simple and delete the name option :smiley: your help is appreciated my friend <3

Use the Firebase component’s getTags block - this will return a list of all the tags at whichever level in your structure you set with the projectBucket.

With regard to you blocks, you need to test the contents of the textbox against each of the vlaues in the getTags list.

1 Like

its really working, now its not replaced anymore, but i can’t understand what u mean by " test the contents of the textbox agains each of the values in the getTag list"

do u mean i wirte about 12 different messages and check in the firebase?

No, call the list of tags with getTags then iterate over the list from getTags and compare the value of the textbox with each item in that list. If there is a match, then alert the user that the tag name is already in use.

Learn about using lists:

General Tutorials

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