Select

Select #

The select field generates a dropdown selectbox for selecting strings or numbers. The output is a number or string. If multiple is set true the out is an array of numbers or strings.

Select field

Select field

Select multiple field

Select multiple field

Select dropdown with options

Select dropdown with options

Properties #

propertyvalue typeoptionaldescription
keystringmandatoryKeys are for internal use and must be unique
titlestringoptionalThe title of the element
tipstringoptional (default: null)Text entered here with markdown formatting is displayed as context help in an overlay box
defaultstring OR number OR array of stringsoptional (default: null)default value when the key is not set yet
multiplebooleanoptional (default: false)Enable multiple selection
autoSavebooleanoptional (default: false)Form data is automatically saved after changing the value
option_image_pathstringoptional (default: null)path to images having the same name as the options values e.g. quiqr/model/images
option_image_widthnumberoptional (default: null)when option_image_path is set image width as well to have a aligned option listing
option_image_extensionstringoptional (defaul: null)when option_image_path is set, optionally set extension to e.g. jpg. Then all images should be of type jpg.
optionsarray of dictionaries OR array of stringsmandatoryArray with title/value pairs, or an array with strings when text and value are the same
options.[n].textstringoptionalString with option visible text
options.[n].valuestringoptionalString with option value to save when selected

Example 1 #

This example shows when value and text differ

Configuration #

./quiqr/model/base.
     
default: 2
key: sample_field
multiple: false
options:
- text: Option 1
  value: 1
- text: Option 2
  value: 2
- text: Option 3
  value: 3
title: Sample field
type: select
default = 2
key = "sample_field"
multiple = false
title = "Sample field"
type = "select"

[[options]]
  text = "Option 1"
  value = 1

[[options]]
  text = "Option 2"
  value = 2

[[options]]
  text = "Option 3"
  value = 3
{
   "default": 2,
   "key": "sample_field",
   "multiple": false,
   "options": [
      {
         "text": "Option 1",
         "value": 1
      },
      {
         "text": "Option 2",
         "value": 2
      },
      {
         "text": "Option 3",
         "value": 3
      }
   ],
   "title": "Sample field",
   "type": "select"
}

Output #

sample_field: 2

Example 2 #

This example shows when value and text are the same

Configuration #

./quiqr/model/base.
     
default: 2
key: sample_field
multiple: false
options:
- Option 1
- Option 2
- Option 3
title: Sample field
type: select
default = 2
key = "sample_field"
multiple = false
options = ["Option 1", "Option 2", "Option 3"]
title = "Sample field"
type = "select"
{
   "default": 2,
   "key": "sample_field",
   "multiple": false,
   "options": [
      "Option 1",
      "Option 2",
      "Option 3"
   ],
   "title": "Sample field",
   "type": "select"
}

Output #

sample_field: 2

Known issues #

Default property is not working.