Question T13352
Visible to All Users

the matrix questions default values are not working when names have uppercases or spaces

created 2 years ago

i am using this json for a survey, but the default values are not displaying

JSON
{ logoPosition: 'right', pages: [ { name: 'Página1', elements: [ { type: 'matrix', name: 'field_id_1685736911201', title: 'question1', defaultValue: { 'Hilera 1': 'Columna 1', 'Hilera 2': 'Columna 3', }, columns: ['Columna 1', 'Columna 2', 'Columna 3'], rows: ['Hilera 1', 'Hilera 2'], }, { type: 'matrixdropdown', name: 'field_id_1685736915849', title: 'question2', defaultValue: { 'Hilera 1': { 'Columna 1': 3, 'Columna 2': 2, 'Columna 3': 1, }, 'Hilera 2': { 'Columna 1': 1, 'Columna 2': 2, 'Columna 3': 3, }, }, columns: [ { name: 'Columna 1', }, { name: 'Columna 2', }, { name: 'Columna 3', }, ], choices: [1, 2, 3, 4, 5], rows: ['Hilera 1', 'Hilera 2'], }, { type: 'matrixdynamic', name: 'field_id_1685736921198', title: 'question3', defaultValue: [ { 'Columna 1': 1, 'Columna 2': 2, 'Columna 3': 3, }, { 'Columna 1': 3, 'Columna 2': 2, 'Columna 3': 1, }, ], columns: [ { name: 'Columna 1', }, { name: 'Columna 2', }, { name: 'Columna 3', }, ], choices: [1, 2, 3, 4, 5], }, ], }, ], widthMode: 'responsive', };

Clipboard-File-1.png

Answers approved by surveyjs Support

created 2 years ago

Hello Ariel,
Your JSON works perfectly in this example.
Probably you use survey.data = yourValues; in your code. If it is a case, please use survey.mergeData(yourValues) function to keep your default values.

Thank you,
Andrew
SurveyJS Team