I have a questionnaire with 100 yes/no questions that are separated by 3 sections, and that I need to implement on a website. The goal is to create a multi-step form (each question will appear at a time) and then handled the answers of the users (PHP or Node.js will be used to handle the data).
我认为,创建有100个标签和输入html档案的形式是一种好的做法。 因此,由于表格太长,我是否应在javascript案卷中提出一系列问题,并将这些问题分号列入html案?
由于问题分三节,我认为一系列物体将适合:
const questions = [
{ text: "Question 1", section: "Section 1" },
{ text: "Question 2", section: "Section 1" },
{ text: "Question 3", section: "Section 1" },
{ text: "Question 4", section: "Section 2" },
{ text: "Question 5", section: "Section 2" },
{ text: "Question 6", section: "Section 2" },
{ text: "Question 7", section: "Section 3" },
{ text: "Question 8", section: "Section 3" },
{ text: "Question 9", section: "Section 3" },
];
这种做法是否好? 或者,我是否在html档案中制造所有标签和投入?