I have run into the following problem several times and have an ok workaround, but not great one.
What I am trying to do. I want to have each user of my system create a custom survey - so they can create questions custom to them. I do this by having something like this:
questions
user - link to users
question - text
I can easily then modify/add/edit the questions per user and then display the questions for just one user by doing a repeating group and searching for all questions for the logged in user.
The issue comes when I want them to rate themselves against the questions. I have created a table
responses
user - link to user
question - link to question table above
answer - the answer (in my need 1 to 10)
I can build the form easily - having a drop down in the repeating group. The repeating group queries questions where user is user. So each row has the question text and then a dropdown with 1 to 10. What I would like to do is have a submit button outside the repeating group and loop through each item in the repeating group when that is hit and save the dropdown value into the reponses table. However, I can’t figure out how to do this.
I have found a work around sort of. I can have each dropdown trigger an action on change and save the value in the responses table when they are changed. This sort of works, however there are two problems with that: 1) I can’t force all fields to be completed and 2) If you change your selection two or more times each change gets saved in the DB. I could probably work around these two issues, but it feels like there should be a more elegant and simple way to solve this by just looping through items in a repeating group when you press a button.
Thanks for any help.