Submit comments via firebase?

Hello there i need help with something.

I need to put a submit text+button and get my submissions in the firebase section.

Can anyone help me with blocks image please?
P.S i need to see all comments in the firebase, so everytime someone submit a comment this will be added in the firebase.

What is the authentication and authorisation setup of your firebase project?

Are you using the MIT firebase component?

yes exactly, i use the MIT firebase extension

You could do like this:

Further details required for a more expansive answer

1 Like


this is what i get. i did everything like yours but nothing worked. i write something in the text but is not working


Use the Textbox3.Text block, NOT the Textbox3 component block

1 Like

This is probably better as will return all comments to all users, using the dataChanged event.


I did everything like yours but nothing work .I write the comment and when click submit the comment is not showing

How have you setup the firebase component in the designer ?

You had several hilarious errors in your blocks:

The first one you marked why? is valid. If there is no empty list there, you cannot append an item to it. This routine does the check to ensure that the tag comments exists as an empty list.

The second one quite right, I did not spot that. Another case of I did everything like yours not being quite right in the same topic :slight_smile:

I see the WHY now, but it is not foolproof.

What if there existed a value for the comments tag, but it is not a list?
It would slip through the logic until an append was attempted.

I am not thrilled by the ambiguity of receiving back an empty list, signalling either:

  • the read request came up empty because the tag/value was never initialized and the read request asked for an empty list as default, or
  • that tag/value was initialized with that empty list, so let's just go back and write out that empty list again.

This trick works okay in TinyDB, because TinyDB has no append block, just entire replacement of the tag/value.

For an append situation, maybe a text 'NOT FOUND' default value with special handling for detection and initialization would look more obvious?

The else provides for that (if comments list is not empty then set global comments to the list)
This approach is needed because, you cannot append if there is nothing in the tag, and it also wakes up the dataChanged event in Firebase, which won't fire otherwise.

1 Like

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