Skip to content

Rank a series of choices in a choice list by dragging-and-dropping.

License

Notifications You must be signed in to change notification settings

surveycto/ranking-choices

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ranking choices

Moving Ranked No numbers

Description

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.

Download now

Features

  • 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.

Data format

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.

How to use

Getting started

To use this field plug-in as-is:

  1. Download the sample form from this repo and upload it to your SurveyCTO server.
  2. Download the rankingchoices.fieldplugin.zip file from this repo, and attach it to the sample form on your SurveyCTO server.
  3. Adjust the parameter if you would like to use a different unit (see below).

Parameters

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 1, then the enumerator can swipe to the next field without making any changes. This is a risky design, because the enumerator could go to the next field without actually checking the order of the choices.

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

Default SurveyCTO feature support

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

More resources

About

Rank a series of choices in a choice list by dragging-and-dropping.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •