Survey drop-down lists

LabKey Support Forum (Inactive)
Survey drop-down lists Jon (LabKey DevOps)  2015-05-05 17:09
Status: Closed
 
Hi Michelle,

So there is a way to do both things successfully.

This is the code sample for a combobox dropdown that will allow you to have a blank:

        {
          "extConfig": {
            "width": 800,
            "hidden": false,
            "xtype": "combo",
            "name": "choices",
            "fieldLabel": "choices",
            "queryMode": "local",
            "displayField": "Text",
            "valueField": "value",
            "emptyText": "Select...",
            "forceSelection": true,
            "displayTpl": "<tpl for='.'><tpl if='Text != \"&nbsp;\"'>{Text:htmlEncode}</tpl></tpl>",
            "store": {
              "fields": [{"name": "Text"}, "value"],
              "data" : [
                {"Text": "&nbsp;", "value": "0"},
                {"Text": "Bacon", "value": "Bacon"},
                {"Text": "Eggs", "value": "Eggs"},
                {"Text": "Waffles", "value": "Waffles"},
                {"Text": "Pancakes", "value": "Pancakes"}
              ]
            }
          }
        }

Now, to create something that looks like a Likert scale, you can use radio buttons to accomplish this. The example code is below:

        {
          "extConfig": {
            "width": 800,
            "hidden": false,
            "fieldLabel": "Some Radio",
            "xtype": "radiogroup",
            "name": "someradio",
            "columns": 5,
            "items": [
              {
                "boxLabel": "Item 1",
                "name": "some",
                "inputValue": 1
              },
              {
                "boxLabel": "Item 2",
                "name": "some",
                "inputValue": 2
              },
              {
                "boxLabel": "Item 3",
                "name": "some",
                "inputValue": 3
              },
              {
                "boxLabel": "Item 4",
                "name": "some",
                "inputValue": 4
              },
              {
                "boxLabel": "Item 5",
                "name": "some",
                "inputValue": 5
              }
            ]
          }
        }

Give these a try and let us know if you have any further questions.

Regards,

Jon