# How do you add upvoting in Adalo?

Model one Adalo vote per user, keep the button synchronized with saved state, count relationships safely, and prevent rapid taps from creating duplicates.

- Canonical URL: https://adalocado.com/answers/upvoting
- Verification: Verified from current public evidence
- Topic: Actions and Logic
- Skill level: Intermediate
- Last reviewed: 2026-08-12
- Index status: index-now

## Short answer

Relate users to the records they upvote—or create a Vote join collection—then add or remove the relationship on tap and display the related-record count.

Model a vote as the relationship between one user and one record. A dedicated Vote collection makes uniqueness checks, timestamps, moderation, and auditing clearer; a direct relationship is simpler when membership is all that matters. The selected state and count must come from saved records rather than temporary visual state.

## Intended outcome

A persistent vote control that counts one selection per user.

## Requirements

- Users collection
- A collection of voteable records
- Relationship or Vote join collection

## Step by step

1. **Model the vote**

   Use a direct relationship for simple membership or a Vote record for timestamps and auditing.

2. **Show the count**

   Display the relationship or Vote count for the current record.

3. **Add vote**

   On the unvoted state, relate the logged-in user or create a Vote record.

4. **Remove vote**

   On the voted state, remove the relationship or delete that user’s Vote record.

5. **Test duplicates**

   Tap rapidly and revisit the screen to ensure one user cannot create unintended duplicates.

## Why it works

- A vote is a relationship between one user and one record.
- A join record is preferable when the vote needs its own fields.

## Data model

| Collection | Properties | Relationships |
| --- | --- | --- |
| Voteable records | Title, Status | Has many votes |
| Votes | Created Date | Belongs to one user and one voteable record |

## Common failures

### Counts drift upward

Ensure the create action is conditional on no existing vote for that user and record.

## Testing checklist

- [ ] One user can add at most one vote to the same record.
- [ ] Removing a vote reduces the visible count and restores the unvoted state.
- [ ] Two different users produce a count of two without sharing button state.
- [ ] One user produces at most one vote
- [ ] Count updates after add/remove
- [ ] State persists after reload

## Limitations

- A production voting system may need stronger duplicate and concurrency guarantees than client actions provide.

## Community evidence

### [Linking 3 details screens to one favorites screen](https://forum.adalo.com/t/linking-3-details-screens-to-one-favorites-screen/66301)

Replies recommend a separate Favorites collection related to the current user and favorited records, corroborating the auditable join-record pattern used for votes. Boundary: Favorites are structurally analogous to votes but do not prove duplicate prevention or concurrent vote-count behavior.

## Sources

- [Adalo relationships](https://help.adalo.com/database/relationships)
- [Adalo component visibility](https://help.adalo.com/component-basics/changing-a-components-visibility)
- [Adalo join collections](https://help.adalo.com/database/relationships/adalo-join-collections)
- [Adalo forum: separate favorites collection](https://forum.adalo.com/t/linking-3-details-screens-to-one-favorites-screen/66301)

Markdown version: https://adalocado.com/answers/upvoting.md
