surveyjs / survey-library

Free JavaScript form builder library with integration for React, Angular, Vue, jQuery, and Knockout.
https://surveyjs.io/form-library
MIT License
4.19k stars 809 forks source link

defaultRowValue for matrix dynamic question #1166

Closed andrewtelnov closed 6 years ago

andrewtelnov commented 6 years ago

If this property is defined defaultRowValue: {column1: columnValue1, column2: valueValue2, ...} then all new rows will be set with predefined data. Rows can be created from UI or by setting rowCount property.

masciugo commented 6 years ago

thank you! Are you considering defaultPanelValue for dynamic panel too? It should work exactly the same

andrewtelnov commented 6 years ago

@masciugo defaultPanelValue is already implemented. Do you have any forms/surveys where defaultRowValue and defaultPanelValue could be used? We are looking for good data to make examples.

Thank you, Andrew

masciugo commented 6 years ago

@andrewtelnov We use surveyjs in a clinical context where doctors fill in survey as patient's clinical record. I'm afraid our examples are too specific but we usually use defaults for new panels/rows when most of their inputs are almost always the same and we need to save doctor's time during form filling. For example we store array of gene mutations whose positions are commonly identified using a reference genome. The reference genome version changes not very often

kaphert commented 6 years ago

@andrewtelnov what is the difference in using these defaultPanelValue and defaultRowValue properties and setting a default on the actual question within the row or panel with defaultValue?

andrewtelnov commented 6 years ago

@kaphert defaultValue works for any question. It allows in Builder set the default value for the question. It equals to: survey.setValue("questionName", defaultValue); defaultRowValue is the value that assign to the new added row in matrix dynamic question and defaultPanelValue is the value that assign to the new added panel in the panel dynamic question.

I hope it makes sense to you now.

Thank you, Andrew