I want to add a question to a survey and believe I need to add some code to an existing question type.
The task: Respondents will be presented with a list of words of objects (e.g. brush, tent, camera) and their task is to group those objects into whatever groups they want. I am interested in the number of groups they choose to create. That is, whether they choose to divide them into 3, 5, or maybe even as many as 9 different groups. Note that the number of groups is really the only thing I am interested in here. Please see my sketches which (hopefully) help illustrate the basic setup of the task. In my examples, the respondent chose to divide the groups into three (3) groups.
The drag-and-drop question type is closest to what I need. But the problem is that it requires me to specify categories in advance, and I can't do this because it is up to respondents to create unnamed groups themselves.
Possible solution: One solution is to add a button called something like "Create a group" to some existing question type ,which respondents then can click on, and add, either by dragging and dropping, or by writing the objects in each box. (NOTE: they do not have to name the categories or anything).
Perhaps someone has had a similar problem? Or has ideas as to how I can design such a question? I have very limited coding skills and would greatly appreciate any input.
Thanks in advance!
Sofia
One of the solution can be: In Pick group rank question add groups equal to the total items you want to show. Now using JS as you suggested create a ADD button. On the load of the question hide all the groups except the first. On click event of add button, make the next group (of the last visible group) visible.
Thanks for your response! I think that is a terrific solution, actually.
The problem is that I do not have the JS skills to create a button, any less to add a function to the button, I'm afraid.
I'm also not sure how to hide all groups except the first one, can I do this with JS as well?
I will continue trying to figure this out via googling, but if you know how to write such code I'd greatly appreciate any help.
Use the below code in question HTML to create button:
Paste the below code in the JS of the PGR question
jQuery("div.Group:not(:first)").hide();
jQuery("#btn").on('click',function(){ jQuery("div.Group:eq("+parseInt(parseInt(jQuery("div.Group:visible").length))+")").show();
});
You can modify this code more as required
Ah, thanks so much! This helped solve my problem - it's working perfectly.
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.