var newitem := Question{}
  init {
    newitem.answers := [Answer{}];
  }
  form {
    label("Question: ") { input( newitem.question)}
    for (a in newitem.answers) {
      label("Answer: ") { input( a.answer )}
    }
    submit action{
      newitem.save();
     }{ "Add question" }
  }

above did not save answers, workaround:

  var newitem := Question{}
  var answers := [Answer{}]
Submitted by Danny Groenewegen on 31 March 2021 at 15:06

Log in to post comments