Add to friends features and condition button


For my application, I’m busy creating an add-to-friends feature.

For example: the user has access to a list of users and can add anyone he wants as a friend. Users can accept or decline each invitation.

For a few days now I’ve been stuck on one aspect in particular: no longer displaying the “add friends” button when the user has already clicked on it.

To do this, I logically use the “conditional” tab, but whatever condition I set, it never corresponds to what I need.

Here is what I use to do this:

  • a “list of friends” field in the Users tab.

-A tab with all friend request news :

  • The condition and the materialIcon:

  • A Workflow on the material icon to creat the new friend request and change the friend statment:

I don’t know if this is enough to help me, I can give more details if needed …

I’ve really looked at all the tutorials and other topics but I haven’t found any solutions …

Thank you very much for your help

Looking at your condition on the add friend button, you’re making that bottom visible if the cell’s user is not in the current user’s friends list. Is this button not visible by default?

Hello @msgiblin thank you for you help

Yes, the button was visible by default, so it was displayed all the time!

A simple thing, but when you’re new to bubble it’s not the first thing you think of :slight_smile:

I have another question : Although this button is not visible by default, it’s still displayed. Do you think it’s my condition that’s not working?

I also have one last question. I want to display dynamic data only after a click.

In fact, the data is displayed after the click, but before that, I still have the “text” elements displayed. For example, I want to display the name of a company:

Entreprise: Parent group’s User’s Entreprise

I don’t want the “Entreprise:” to be displayed before the click. Here’s a screenshot of the example:

Capture d’écran 2024-03-11 à 13.23.50

Thank you a lot for your help :+1:

I took a look at your condition, and it’s a pretty one. I recommend for your testing purposes breaking it down into the 3 separate pieces and seeing if it’s working as you believe it is. Sometimes i like to put visible elements on the page for each condition (during testing only) to see how it’s working. Additionally, run the page in debugger mode step by step and you’ll see it addressing each condition and whether the condition is met or not.

I recommend creating a custom state of type Entreprise (if Entreprise is a datatype), by default is empty. Set a workflow: when button is clicked, set state to Parent Groups Entreprise.

Thank you for all your advice, It’s help me a lot in my learning of Bubble.

I create 3 buttons with my 3 pieces of condition and i have the same result. I looked manually in the fields of data type if data were present and that’s the case.

Also, I applied different part of my condition to another button (which is not displayed as intended) and it displays it anyway …

On reflection, I’m thinking that maybe a field has the wrong type and so the condition can’t work. But that doesn’t seem possible because my other buttons use the same fields and their conditions apply.

I’ll keep you posted if I find a solution (if you have any other ideas, don’t hesitate)!

About the display of “Entreprise” :
Unfortunatly Entreprise is a data field, do I have to remind this to convert it to data type ?

1 Like

Are you saying Entreprise is a field on a datatype? If so, create the state as the datatype that the field Entreprise is a part of. When you need to reference that state, you’ll choose that state’s thing’s Entreprise.

I have done this on the “Entreprise” field (entreprise is part of the user datatype) :

And for the workflow :

I am not sure that I understood everything, does it look good for you ?

Thanks for your advices :slight_smile:

You’re close! You’ll still have to set the value of what the Custom State will be.