Click an elment to update a number

Hey everyone,

I am trying to built a “likes” and “dislikes” system whereas a numbe ris dynamically changed each time the like or dislike a contributor presses the like button. Is there any way to make this happen?

Roughly:
When element is clicked → make changes to a thing → thing’s likes = this thing’s likes + 1

Thank you for your reply, what do you mean by "this things likes + 1. What would be the best way to incorporate it adding +1?

Here’s a screenshot from Reddit. I’m guessing this is the type of UI you’d use? Would make the most sense I think

Screen Shot 2022-05-02 at 10.14.22 am

Off the top of my head I’d do it like this:

  1. Create a data type (say ‘votes’) where you record the individual votes each user makes, and of course link it back to the data type they are voting on - i.e. a post
  2. When the user clicks the upvote then you add a record 1 to the vote data type or if it’s downvote then you -1
  3. You want to stop users from casting several votes so you would put a state or something that looks up that votes table and if there’s a vote for that post by that user already then you would make the vote they’ve cast not clickable, but you’d leave the other

i.e. if they have upvoted you disable the ability to cast another upvote but you still allow them to downvote to essentially cancel the previous vote

Super rough steer, and there are ways to optimize this for sure. But this should give you a starting point.

I’m sure someone would have posted to this on the forum or done a video on YouTube about this at some point, so might be worth a search or two.


Josh @ Support Dept
Helping no-code founders get unstuck fast :rocket:save hours, & ship faster with an expert :man_technologist: on-demand

Thanks for reaching out. Its still just not clicking for me. I understand what you’re saying. And, I understand how to implement the data types, but no clue how the rest of this would be implemented. For example, how do you implment adding +1 when it is clicked?

No problems.

  1. You would need to make sure the data is stored in a number field in the database
  2. In your workflow you use a “make changes to a thing” action
  3. Make changes to the field you want to update by first calling in the current value and then ‘+1’

i.e. in this case below I have a number field called ‘sort’ which is in a data type called ‘Playlist entry’. This is what it looks like if I want to increase the sort field by 1. Similarly I could -1
Screen Shot 2022-05-03 at 10.59.24 am


Josh @ Support Dept
Helping no-code founders get unstuck fast :rocket:save hours, & ship faster with an expert :man_technologist: on-demand

I post daily about no-code and Bubble on Twitter Follow Support Dept on Twitter

Gotcha. Would you recommend it being a number or a numeric range?

A number is fine for this


Josh @ Support Dept
Helping no-code founders get unstuck fast :rocket:save hours, & ship faster with an expert :man_technologist: on-demand

I post daily about no-code and Bubble on Twitter Follow Support Dept on Twitter

Perfet, thanks Josh!

1 Like