Upvote / Downvote Toggle (+1 / -1)

Hi there,

I want to have a voting system where the default is 0, and if you click the upvote toggle, it goes to +1 and if you click the downvote toggle it would go back to 0. So if the vote is 10 for example, I click the upvote toggle and it goes to 11, and if i click the downvote toggle it goes to 9. I have seen threads on this but it still has not been clear.

Appreciate the help

-Spencer

Hi @dupedrop,

Your post has inspired me to create a video tutorial for this. Enjoy! Adalo Help: Upvotes and Downvotes - YouTube

NB: just uploaded it and it is still being processed at the moment, so probably need to wait several minutes before it’s available :slight_smile:

Best regards, Victor.

3 Likes

@Victor this is incredible work! The part I’m confused about is I have Users, and Products. So a user can upvote or downvote a product. How does that work with this tutorial? Do votes live under products? Or do votes need to have relationships with products and users?

@Victor really stuck on my question above. I have products that I want users to upvote and downvote. With this tutorial users are the ones that get upvotes and downvotes which is really confusing me. I want a user to be able to vote a product up or down. Any chance you can share how to structure the database to make it work? What changes do I need to make with your current tutorial to make that work?

Hey Victor, any chance you could follow up on adding products to this. I would really appreciate it.

@dupedrop - Having had a look at Victor’s video, which is excellent, I think you’ll need to set up a “Votes” collection as per his example however you’ll then relate this new collection to your products collection AND your users collection. This way you’ll know who voted for which product. You can then use the model Victor presented to add a voting control onto your products page and assign that to the current product’s => votes and filter for the logged-in user (Current Product => votes => user => email is equal to Logged In user => email).

1 Like

Hi @dupedrop,

Please see 2 videos with explanations:

Hope this helps.

Best regards, Victor.

2 Likes