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

Error while sending answer data with version flutter_survey_js-0.0.2-dev.5 #100

Closed Vpdwivedi closed 11 months ago

Vpdwivedi commented 11 months ago

Describe the bug While I was using version 'flutter_survey_js-0.0.2-dev.4', I was getting an error while sending answer data and you suggested to store a response using json.encode(response) in your db and then pass the answer using json.decode(response). I did and it was working fine. I upgraded the version to 'flutter_survey_js-0.0.2-dev.5', and the same stopped working for Dynamic Matrix however it works fine for simple Matrix. Then I reverted back to 'flutter_survey_js-0.0.2-dev.4' and checked with Dynamic Matrix and this is working fine previous version. So I guess something has been changed in the "flutter_survey_js-0.0.2-dev.5" that is causing an issue with Answer for Dynamic Matrix.

To Reproduce SurveyJs json

{
 "title": "Test Survey Form",
 "description": "1Test Survey Form Test Survey Form Test Survey Form Test Survey Form",
 "logoFit": "cover",
 "logoPosition": "right",
 "pages": [
  {
   "name": "Page1",
   "elements": [
    {
     "type": "matrixdynamic",
     "name": "TABL001",
     "title": "Tableau 001 : Couverture de la population par les mutuelles sociales toutes prestations (Une liste de mutuelle sera fournie)",
     "columns": [
      {
       "name": "ASSURE_AMO_CHARGE_MED~N~M",
       "title": "Nom de la Mutuelle Sociale"
      },
      {
       "name": "Column 2",
       "cellType": "dropdown",
       "choices": [
        "Oui",
        "Non"
       ],
       "storeOthersAsComment": true
      },
      {
       "name": "Column 3"
      }
     ],
     "choices": [
      1,
      2,
      3,
      4,
      5
     ]
    },
    {
     "type": "matrixdropdown",
     "name": "TABL002A",
     "title": "Tableau 002 a: Couverture de la population par l’AMO (interopérabilité entre le SISo et la base de la CANAM)",
     "columns": [
      {
       "name": "ASSURE_AMO~N~M",
       "title": "Nombre d’assurés  de l’AMO H",
       "cellType": "dropdown",
       "choices": [
        "Yes",
        "No"
       ],
       "storeOthersAsComment": true
      },
      {
       "name": "ASSURE_AMO~N~F",
       "title": "Nombre d’assurés  de l’AMO F"
      }
     ],
     "choices": [
      1,
      2,
      3,
      4,
      5
     ],
     "rows": [
      {
       "value": "INPS_A",
       "text": "INPS - Actif :A"
      },
      "Row 2",
      "Row 3",
      "Row 4",
      "Row 5",
      "Row 6",
      "Row 7",
      "Row 8"
     ]
    },
    {
     "type": "matrixdropdown",
     "name": "question2",
     "title": "Tableau 002 a: Couverture de la population par l’AMO (interopérabilité entre le SISo et la base de la CANAM)",
     "columns": [
      {
       "name": "ASSURE_AMO~N~M",
       "title": "Nombre d’assurés  de l’AMO H"
      },
      {
       "name": "ASSURE_AMO~N~F",
       "title": "Nombre d’assurés  de l’AMO F"
      }
     ],
     "choices": [
      1,
      2,
      3,
      4,
      5
     ],
     "cellType": "text",
     "rows": [
      {
       "value": "INPS_A",
       "text": "INPS - Actif :A"
      },
      "Row 2",
      "Row 3",
      "Row 4",
      "Row 5",
      "Row 6",
      "Row 7",
      "Row 8"
     ]
    },
    {
     "type": "text",
     "name": "question1"
    }
   ],
   "title": "COUVERTURE DES RISQUES SOCIAUX"
  }
 ]
}

SurveyJs answer


{"TABL001":[{"ASSURE_AMO_CHARGE_MEDNM":null,"Column 2":3,"Column 3":null}],"TABL002A":{"INPS_A":{"ASSURE_AMONM":null,"ASSURE_AMONF":null},"Row 2":{"ASSURE_AMONM":null,"ASSURE_AMONF":null},"Row 3":{"ASSURE_AMONM":null,"ASSURE_AMONF":null},"Row 4":{"ASSURE_AMONM":null,"ASSURE_AMONF":null},"Row 5":{"ASSURE_AMONM":null,"ASSURE_AMONF":null},"Row 6":{"ASSURE_AMONM":null,"ASSURE_AMONF":null},"Row 7":{"ASSURE_AMONM":null,"ASSURE_AMONF":null},"Row 8":{"ASSURE_AMONM":null,"ASSURE_AMONF":null}},"question2":{"INPS_A":{"ASSURE_AMONM":null,"ASSURE_AMONF":null},"Row 2":{"ASSURE_AMONM":null,"ASSURE_AMONF":null},"Row 3":{"ASSURE_AMONM":null,"ASSURE_AMONF":null},"Row 4":{"ASSURE_AMONM":null,"ASSURE_AMONF":null},"Row 5":{"ASSURE_AMONM":null,"ASSURE_AMONF":null},"Row 6":{"ASSURE_AMONM":null,"ASSURE_AMONF":null},"Row 7":{"ASSURE_AMONM":null,"ASSURE_AMONF":null},"Row 8":{"ASSURE_AMONM":null,"ASSURE_AMONF":null}},"question1":null}

Expected behavior As explained above, this response was saved in DB using json.encode() and I have shared the same response above. While sending this response to SurveyJS, I am using json.decode() below are the few screenshots for the reference:

Screenshots

Error that I am getting:

image

Answer function:

image image

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context