goxiaoy / flutter_survey_js

Flutter client library for parsing and display surveyjs.io survey
https://goxiaoy.github.io/flutter_survey_js/
MIT License
15 stars 15 forks source link

checkbox `other` not pre-populating answer correctly #116

Closed tjones-dev closed 8 months ago

tjones-dev commented 8 months ago

Describe the bug Using the checkbox element and providing it with an existing answer that matches SurveyJS behavior, pre-populates the survey with other instead of the expected string.

To Reproduce SurveyJs json

  "logoPosition": "right",
  "pages": [
    {
      "name": "page1",
      "elements": [
        {
          "type": "checkbox",
          "name": "question1",
          "choices": [
            {
              "value": "Item 1",
              "text": "Latex"
            },
            {
              "value": "Item 2",
              "text": "Peanuts"
            },
            {
              "value": "Item 3",
              "text": "Spinach"
            }
          ],
          "showOtherItem": true,
          "otherText": "Food Allergy"
        }
      ]
    }
  ]
}

SurveyJs answer

  "question1":[
    "Item 1",
    "other"
  ],
  "question1-Comment":"Shell fish"
}

Expected behavior Should populate the other element with Shell fish

Screenshots image

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context N/A