我想创建一个包含动态问题的问卷。收音机选项是相同的,但问题会有所不同。我该怎么做呢?
我使用了followimg代码,但我遇到了“遇到错误:SimplePanel只能包含一个子窗口小部件”
var form = app.createFormPanel().setId('form').setEncoding('multipart/form-data');
var count = 1;
for (var row in arr) {
infoLabel = app.createLabel(row).setId('infoLabel');
var myRadio1 = app.createRadioButton("radio"+count, "Present").setFormValue('P');
var myRadio2 = app.createRadioButton("radio"+count, "Absent without notice").setFormValue('N');
var myRadio3 = app.createRadioButton("radio"+count, "Excused Absence").setFormValue('X');
var myRadio4 = app.createRadioButton("radio"+count, "Late").setFormValue('L');
//create a form and put the radios in it
var formContent = app.createGrid().resize(1,4);
form.add(formContent);
formContent.setWidget(0, 0, myRadio1);
formContent.setWidget(0, 1, myRadio2);
formContent.setWidget(0, 2, myRadio3);
formContent.setWidget(0, 3, myRadio4);
panel.add(infoLabel);
count++;
}
panel.add(form);
panel.add(button);
app.add(panel);