working

entity Post{
  files : {Attachment}
}

entity Attachment{
  file : File
}

var p123:=Post{}

page root{
  for(p:Post){
    navigate edit_content(p){"go"}
  }
}

template file_list(c:{Attachment}){
  for( f in c ){
    ~f.file.getFileName()
  }
}

ajax template get_files(c : Post) {
  file_list( c.files )
}

page edit_content(c : Post) {
    var a := Attachment{}
    div {
        //placeholder attachement_list {
          file_list(c.files)
       // }
        form {
          input(a.file)
          submit uploadFile() {"Upload"}
        }
    }
    action uploadFile() {
       c.files.add(a);
      }
}

blank page no error:

page edit_content(c : Post) {
    var a := Attachment{}
    div {
        placeholder attachement_list {
          file_list(c.files)
        }
        form {
          input(a.file)
          submit uploadFile() [ajax]{"Upload"}
        }
    }
    action uploadFile() {
       c.files.add(a);
       replace(attachement_list, get_files(c));
    }
}
Submitted by Danny Groenewegen on 29 March 2022 at 21:24

Log in to post comments