Question T5939
Visible to All Users

What is the difference between a question and an element

created 4 years ago

What is the difference between a question and an element in the survey itself and in the json used as a model.

Is there any reason to choose one over the other when creating a survey or trying to access either survey or json properties?

Answers approved by surveyjs Support

created 4 years ago

Hello,
If you are talking what difference in this code:

JavaScript
{ elements: [ { type: "text", name: "question1"} ] }

vs

JavaScript
{ questions: [ { type: "text", name: "question1"} ] }

Then there is no difference. We develop this project for several years and in the beginning it was relatively simple library. We did not have elements from the beginning, but have questions. Several years ago we introduced containers, panels. Panels are not questions and they do not have values and many other properties. As result we rename questions to elements. However, questions is working as well.
However, if you decide to use the very old survey JSON that was created 5 years ago in the latest version (1.8.21), it will work correctly.

If you are talking about properties questions and elements in panel or page, then questions will use elements array and remove all panels from it, by keeping questions only.

Thank you,
Andrew
SurveyJS Team