ad 1) You may use the multiple dropdowns for that - however, a text input with suggestions may be better for a large number (>20) of options.
Also, a "ranking" question may be better then the multiple dropdowns, depending on how many sports you offer, and how many ranks you offer. This would also prevent people from placing the same sport on two ranks.
I do not want that people can choose "swimming" multiple times
If you prefer the dropdowns, you'll have to do some JavaScript to prevent that. And, of course, you can also use PHP code to check after the click on "next".
However, you may want to allow for errors, so you discover careless cases.
2) I would like to categorize the possible answers.
You'll need a bit PHP code for that. First, make an array with the sports's IDs and the categories, for example:
$cats = [
1 => 1,
2 => 1,
3 => 1,
4 => 2,
5 => 2,
6 => 2
];
Based on that and on getItems()
or valueList()
(depending on the question type), you can use a loop to count how many sports from which categorie have been chosen. Use repeatPage()
to show an error and make the respondent change their answer, if you're not satisfied with the answer.