A
A
Alexander Pankov2015-05-20 19:14:29
JavaScript
Alexander Pankov, 2015-05-20 19:14:29

How to program surveys, questionnaires?

Hello, the task was to implement a questionnaire for users.

1) The user visits a certain address and questions are opened in front of him in the order
those 1 - 2 - 3 (1 in the window) (after each answer, either submit, or something else, in general, some kind of action, in frequency, loading and displaying the next question)

2) After he answered, the result is displayed ...

So the question is how to build such an architecture?

Let's say 50 questions -> 8 results of the questionnaire ...
1) How does this definition of the result occur in general (according to the model)? (Does the question have some weight or what?)
2) Is it better to load everything on Ajax?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
Timur Shemsedinov, 2015-05-20
@MarcusAurelius

There are billions of reasonable options. And even more idiotic. It's like asking how best to make a car? If there was an answer to this question, then there would be one brand and one model.
I would advise you to make a description of the questions in JSON, load this data with a page or a separate request, and then render HTML from the data on the client.

[
  { question: "Как Вас зовут?", type: "input" },
  { question: "Существует ли истина?", type: "select", answers: ["да", "нет"] },
  { question: "Как возможна справедливось?", type: "select", answers: ["легко", "трудно", "ни как"] }
]

Also check out React to learn how to do it and Angular to learn how not to do it, tinker with different client-side templating engines. You need to gain experience to design it better than others.

M
Maxim Timofeev, 2015-05-20
@webinar

How in general (according to the typical) does this definition of the result occur? (does the question have some weight or what?)

As you wish. The calculation formula can be any.
You can use ajax, but I don't see the point.
You can use jquery to load everything and hide all stages except the current one. Switch them show() and hide(), and then either send them to the server and process them in php and display the result, or process them with the same jquery and display the result.
You can submit after each stage, but you will need to remember all the previous stages. This is more difficult in my opinion.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question