Hi all, I am currently trying to create a database that contains a user’s total points from what items they have submitted using my form to my item database. I’m trying to figure out how to:
1.) have my two databases connected so when a user enters an item into the database, they get points for it in the user points database, but if they remove it it removes the correct amount of points from the user points database,
2.) have the submit button on click check if the user has an entry in the user points database and if they don’t create one,
3.) update their points in the points database if they do have an entry instead of making a bunch of new entries to save storage space.
I want these to be separate because I don’t want a new entry in the points database for each time a user submits an item and I just want it updated to their new user points value, but I do want each item to be a new record in my items collection since each one has a description and image with the item.
Below is my form. I can get the index from the “Item” dropdown which determines how many points they get, but I don’t know how to send these points to the other database with JS and make sure the points stay connected and up to date with the user’s account. I will also need to get the quantity and multiply the points by the quantity and give a bonus for every x amount of items they submit but I believe I can figure that out on my own with some simple JavaScript. I’m new to Wix and JavaScript as well as working with databases in general so any help is appreciated! I can post my current code as well if anyone needs to see that. I also don’t know if there’s a better and cleaner built-in way to do this. Thanks!