Storing responses from dynamic survey

In my app, Admins can create simple surveys to get feedback from their users. I have 2 data types: 1) Student Experience Questions to stores the questions and type of input field (input, dropdown, radio button, etc), and 2) Student Experience Responses to store each question and the user’s response. In the survey, the questions appear in a repeating group and there’s validation that the user has filled out all of the required fields.

I am stuck on how I create and store the responses in Student Experience Responses via a workflow. Given the questions and the responses are in a repeating group, I’m stuck on how I create multiple entries and then store the values. Would appreciate any help here.

My current plan:

  1. Every time a user edits an input field, store the question and response in custom fields on the repeating group. The custom fields would be lists of texts. In theory, the first entry in the questions list should correspond to the first entry in the responses list.
  2. On submission, I send the questions and responses to a backend workflow which iterates through both lists, creating an entry in Student Experience Responses.

The edge case I run into is when a user tries to edit any responses. How would I remove the previous question and response from the custom fields? This is particularly an issue if the user goes out of order and the response they are editing is not last.

Note: I’m looking for a short-term solution as I need to ship this feature this week. A few months down the road, I plan on switching to a survey plugin and avoid all of this logic.

Saving values from the inputs within the cells of an RG can be quite tricky. There are some solutions out there but I usually use the orchestra plugin

Lmk if you need help setting it up :smile:

2 Likes

Orchestra Plugin worked perfectly. It does take a bit of figuring out to set up, and the documentation doesn’t help

This topic was automatically closed after 70 days. New replies are no longer allowed.