Hi friends,
Please I’ve been trying to figure out how to display single user email randomly any time a button is clicked.
I defined the Text Element to Search for users:random item’s email

The workflow defined on the button was to Show the Text Element

The issue is that the Text element doesn’t respond to the click of the button so email displayed at first does not change.
The email only changes when the page loads or refreshed and i don’t want this.
I want the Text Element displaying the value to always respond to the click of the button by changing value at every click.
Thanks in anticipation
@vincent56 @louisadekoya I’ll appreciate you fellows
1 Like
I would put the text inside a group. Set the Group type as “User.” Then, when the Button is clicked, use the “Send Data to Group” action in the workflow, and send a random user to that specific group. Set the text to Parent Group’s User’s Email and that should work.
1 Like
So that you understand what is going on. Your action only executes when the page loads. All your button is doing is showing text. That won’t refresh the content, in other words, it won’t go fetch new content from the database. What is @andrewgassen is suggesting is for your button to execute a workflow that actually fetches the new user in a random way and then it’s attached to the group containing your text. Then the text will get it’s content from the group and you can display any attribute of that user that your permissions allow.
Love to develop in Bubble!
1 Like
Thanks for your prompt reply @andrewgassen. But i didn’t see “Send Data to Group” action in the workflow. I will appreaciate if you can give me screenshot. Thanks
@mente12 Thanks for your response too. I simply did not really get the process. as i couldn’t locate the “Send Data to Group” action in the workflow.
Perhaps i can understand your points better with screenshot if you can.
Thanks
I may have led you astray, as it’s actually called “Display Data.” Here’s a screenshot of where it is:
Thanks for your time.
I have done this several times to no avail. Is it possible to display the group on the same page with the button?
Then how do i define the workflow to display random user email inside the group.
I have tried many things and still not getting it
It appears simple but have been battling it for days now. When a button is clicked, random user email should be displayed. Simple
Can you make your app public and share the link to the editor? That’ll be the fastest way to get this resolved.
I’m writing this from memory as I don’t have Bubble in front of me, so some details may not be 100% accurate.
Steps:
- Add a group to your page
- Set the group’s content type to User
- Put your text box inside the group. Make sure the text box is inside the group.
- Set the text’s content to Parent group’s User’s email
- Add a step (action) to your button-click workflow: Element actions > Group > Display Data and set the value to Do a search for Users item# :random (or put a random sort on your search and do :first item)
If you still can’t make it work then as @andrewgassen says, you’ll need to make your app public (or create a test page) so that we can help further.
Hi, sorry I’ve been away for a while now. I just came back on the project. @louisadekoya I followed your steps but still no solution.
About making my app public according to @andrewgassen, I’m on personal plan. Is making app public same as Collaborator? If so, the plan i am does not permit collaboration.
Perhaps i don’t know how to make app public.
If any of you do not mind, i can inbox login details into the environment for you to work in. No problem with that.
Please help a brother. Thanks
In the Settings Tab, there are several sub-tabs you can choose from. One of them is “General.” If you go to General, the first option you see is for Application Rights. Set that to “Anybody can Edit” and when you share the link to your editor, other people will be able to get in and help out. That’s how you set it to public!
Alright. This is the editor link https://bubble.io/page?type=page&name=index&id=naijafreebies&tab=tabs-1
When you get in, it’s the admin page i want to implement the stuff.
Thanks a lot
Ok, I have it partially working now. If you go in there and click the button, can you tell me what you get?
Thanks a lot for your quick response.
It’s working partially now but not at second click.
Once i did the first click, it displayed and email. But what i want is that random email should display at every click.
I hope you will be able to help me hack that
Thanks again
Hmm, that’s a good point. I didn’t notice that. I do notice that if I refresh between clicks, it works randomly, but it kinda sucks to refresh each time.
1 Like
I think it’s Ok. I saw that whenever i refresh the page and click button, it displays new user.
That is not bad
That’s odd. It should work! I suppose you could add a page refresh as an action on the button click. You could also try a custom state on the group.
Thinking about it though, @headwaters, wouldn’t you want to save the day’s winner to the database, so that you can have a record of who won? You could have a winners table, with date and user as fields, then when you click that button (or you could even automate this), a new winner is added to the winners table. Your text box could then show the current day’s winner from the database.
1 Like
Thanks @louisadekoya The refresh page option worked. I appreciate. Since yesterday, I’ve been playing around saving the day’s winner inside winners table in database. It’s a remarkable thing to do. Thanks. Let me try harder. If i can’t figure it out. I’ll ask for help.
1 Like
Hi,
Thanks for your help thus far @louisadekoya @andrewgassen i really appreciate.
I have actually been trying something else which is to also display Today’s winner in another page i called “Home”. The “home” is the page users will land after signing in.
Every user must be able to see Today’s Winner
As i generate “Today’s Winner” in admin and it displays, i also want that random item to display in another page “Home”.
How can i achieve this?
Thanks guys
Another reason to pick the user just once and save the winner in the database, then you can show it on any page.
Have you done the tutorials on the home page? I think there is one on storing to and retrieving from the database.
1 Like