scala - Play 2.1.1 Bind a List<Class> from form -


i saw similar questions, couldn't understand answers. have problem getting list of form. i've been doing this:

@entity public class foo extends model { @id public long id;  @required @valid @manytomany public static list<bar> bars = new arraylist<bar>(); }  @entity public class bar extends model{     @id public int id;  @required public string name;         // @required @valid @manytomany public static list<foo> foo = new arraylist<foo>(); } 

and i've tried make interface based on answers i've read

@form(routes.application.newfoo()) { <select multiple name = "bar[].name">         <option name = "bars[].name" value="option1">option1</option>         <option name = "bars[].name" value="option2">option2</option>         <option name = "bars[].name" value="option3">option3</option>     </select> ... } 

but when try form filledform = fooform.bindfromrequest();

    if (filledform.haserrors()) {         return badrequest(views.html.index                 .render(problem.all(), filledform));     } else {         foo foo = filledform.get(); 

foo gets other atributes, list empty. should do?


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -