add text boxes with a plus sign, then determine a loop function (number and content) based on participant's answer | XM Community
Skip to main content

Hi everyone!

I want to ask participants to list the various episodes they had in a day by giving a short title to each of them (e.g., Episode 1: breakfast, Episode 2: working, Episode 3: going to the gym, Episode 4: dinner with friends, Episode 5: movie night). After participants have listed their episodes, I want to ask them how they were feeling during each of the episodes they listed (e.g., what were your feelings during “breakfast”, what were your feelings during “working”, etc).

Participants should be able to list a different number of episodes. I am now using a form field, but I do not know how to make this participant-specific. I want to start with 3 text boxes (episodes 1-3) and allow participants to add up to 7 more boxes (10 text boxes max) using a plus sign.

After they have listed their episodes, I want to present the title of the 1st episode (e.g., “breakfast”) and ask the emotion questions about this episode (what were your feelings during “breakfast”). Then, I want to do the same for all the other episodes. I thought I would need to use a loop function, but the number of loops should be conditioned on the number of episodes each participant listed and the specific content of their episodes. How can I make this happen?

Thanks for any help!

@Eftychia,

Use a text entry matrix instead of a form. Use JS to reveal an additional row each time the + sign is clicked.

Base the loop & merge off the selected choices in the matrix question (the non-blank entries).


Hi @TomG

Thanks for your help! I tried a couple of JS codes I found here but they did not work for me (I’m not good with coding). Could you please help me with the JS for this question?

 


Leave a Reply