I am struggling with this now for a few hours and ChatGPT doesn’t help
I have a button “Go vote!” that is on a screen showing details of a food item.
When I click on “Go vote!” it takes me to a voting page where I can vote on that food item. There are 10 food items and I can pick them via a choice field.
What I want is that when I am on the page of food item 1 and I click on “Go vote!” , that is passes the data to the voting screen and it pre-selects food item 1 in the choice list. I don’t want to look for food item 1 in the choice field.
How can I do this?
I tried combining 2 actions, but then it creates 2 buttons.
Yes, a user could still change the food item and vote for another item.
The idea is that when a user is reading the info of a certain food item (because we are eating it now and have to give it a score), that when he/she clicks on “Go vote!” it should pre-select the food item that the user was reading.
user are not signed in.
Little bit more context: it’s a food contest where participants vote on eacht other’s food item and at the end we show a leaderboard with the average scores
The idea is that before the contest I create a list of participants and each participant can add their food item on their name page.
The food items can be added by the users, with a short description and an image.
OK. Since you are selecting the vote button to open the form from the food item, isn’t that food item value available as an option when setting the default value for the choice component?
No, that is not possible and if I set a default value for the choice field, it always uses the default value even if I come from another food item.
I’ve tried many things already, but this issue is the one that I cannot solve.
It’s not a deal breaker because I can explain to the participants that when they click on “Go vote!”, they get to the voting form and they have to pick the food item that they want to vote on.
A nicer solution would be what I want, but if it’s not possible I can accept it.
Is it letting you set the default value based on a “screen” selection?
Actually let’s circle back a bit, they are already reading that food’s details, then maybe you should just submit the food’s ID and don’t allow them to have a choice component to change anything?
I decided to let them vote on the food details page so there is no need anymore to go the Votes Form
The issue remains though, I am not able to pre-select the “Croqueta Pintxo” so that the participant only needs to fill in the score. I removed the “Name of pintxo” field, but then the vote/score is not stored correctly. It goes to the Votes table, but without any relation to the pintxo.
Hence I need to leave the Name of pintxo field because selecting the pintxo here and then voting does store everything correctly and then the average is calculated and so on.
Can you show me how exactly are you setting up that part (the left hand side and right hand side panels). You can just have a special value from the viewing screen’s food pointing to the “Name of pintxo” column in your destination table, and no need to have a “fixed” default. It can be dynamic.
Thank you for getting back at me.
Is the attached screenshot what you asked for?
I used to have the voting in a separate screen. I think I wrote that somewhere in this thread. A participant click on a pintxo, the pintxo details page opened and you could see a picture, the name of the pintxo, a description and the chef of the pintxo. On the bottom I had an action button “Go vote!” that when clicked had the action “Go to tab - Vote Form”.
There lied the issue, that I wasn’t able to pass the data from the pintxo details page the user was on, to the Vote Form. Since I couldn’t fix this, I decided that it was easier for the vote to happen in the details page itself. That is the screenshot you see here. I just added a form container.
So, how can I pass the data from the pinxto details page to the form container? As you can see in the screenshot, I am now in the Croqueta Pintxo. I added the text “Select the pintxo to vote” in Spanish so that it’s clear that the user needs to select the pintxo and then vote.
Is it clear? Do you need more screenshots or information ??
I don’t remember, I guess because after many attempts, this was the option that worked. The other options don’t work.
I did this all with help of ChatGPT, funny enough.
I have no coding experience and this is my first time making an app. So I had to try many things before I got this far.
TempPintxoID and TempPintxoName are empty columns in the Votes table. ChatGPT suggested to make those columns to write to them when a user clicked “Go Vote!” and then collect the values from those columns. I didn’t understand it, tried it and it didn’t work. The columns have no valies now, but I haven’t deleted them yet.
You should only write to a relation when it’s Airtable if I recall right. Don’t you have a field to store that type of info, let’s say you should write to “Pintxo ID” instead?
Can you choose this as the default value? Maybe you don’t need to have a choice component at all, just write that rowID to the PintxoID column in the destination table from the “Values on screen” section on the left.
I don’t have those values on the left.
I am on a free plan, maybe that’s why??
But you showed me the correct direction.
I am saving the values now to PintxoID and the default value is Row ID.
I hide the choice field with a condition and I added a Fields component in the Form Container where I show the PintxoName.
Now when I go to a pintxo details page, the name of the pintxo is shown and I get give it a score.
I tried deleting the choice field, but then the scores/votes don’t get saved correctly. The score and comment are saved, but it has no relation to a pintxo name or ID.
So, I think this should work now for me.
Do you have any other tips or things I should check?
I created a video, I hope it’s clear.
I made another modification.
Because a user is already in the pintxo details page, there is no need to show the name of the pintxo in the vote form, so I hid the name.
Users now just see where they can enter the vote and an optional comment.
The score gets saved in the Votes table and then in the Leaderboard list the average score and # of votes is calculated / shown.
I think this work pretty well, but as you can see in the video I don’t have the options that you mentioned before.
In a normal form that opens in a new screen, like you used to have, those extra values would show up as additional components. Since you are now using a Form Container, those options show up as Additional Columns on the right side. Either one allows you to easily pass values from the parent row to the destination table without having to create and hide a choice component.