Moving | Ranked | No numbers |
Requires at least Android 7 or iOS 13 to work on SurveyCTO Collect.
Use this field plug-in to allow drag-and-drop ranking of choices. Define choice lists like you usually would, attach this field plug-in, and you're all set.
- Ranking choices of a select_multiple field using drag-and-drop
- Auto-numbering of choices when specified (see Parameters)
- Re-numbering as choices are moved
- Enumerator cannot move forward until at least one change is made, even if they change it back (see Parameters)
This field plug-in also inherits functionality from the baseline-select_multiple field plug-in.
This field will return a space-separated list of all choices in the order they were ranked. For example, if the choice values are 1, 2, 3, and 4, and they are ranked 3, 2, 4, then 1, then the field would have this value:
3 2 4 1
You can use the selected-at() function to retrieve each rank. For example, if the field is called "ranking", you can use the expression selected-at(${ranking}, 0)
to retrieve the value of the choice ranked number 1, selected-at(${ranking}, 1)
to retrieve the value of the choice ranked number 2, and so on.
To use this field plug-in as-is:
- Download the sample form from this repo and upload it to your SurveyCTO server.
- Download the rankingchoices.fieldplugin.zip file from this repo, and attach it to the sample form on your SurveyCTO server.
- Adjust the parameter if you would like to use a different unit (see below).
There are two parameters, both of which are optional:
Name | Description | Default |
---|---|---|
allowdef (optional) |
Whether to allow the default display without making changes. If this parameter has a value of If this parameter is any other value, or if it is not included, at least one change needs to occur before moving on to the next field. This change can be as simple as wiggling a choice (tap-and-hold, and move it slightly so its position does not change) so it stays in the same place. If you do not use this parameter, it is a good idea to include a required message to help the enumerator understand what to do; otherwise, they will get the standard constraint message, “Sorry, that response is required”, which can be confusing. |
0 |
numbers (optional) |
Whether to number the rankings of each choice If this parameter has a value of 1, or if it is not included, then choices will have numbers ranking them from 1 to x (x being the number of choices). The numbers will stay in order even as the choices are moved around. If the parameter has a value of 0, then these numbers will not be shown. |
1 |
Feature / Property | Support |
---|---|
Supported field type(s) | select_multiple |
Default values | Yes |
Custom constraint message | Yes |
Custom required message | Yes |
Read only | Yes |
media:image | Yes (not in choices) |
media:audio | Yes (not in choices) |
media:video | Yes (not in choices) |
minimal appearance |
No |
compact appearance |
No |
compact-# appearance |
No |
randomized appearance |
Yes |
-
Sample form
You can find a form definition in this repo here: extras/sample-form. -
Developer documentation
More instructions for developing and using field plug-ins can be found here: https://github.com/surveycto/Field-plug-in-resources