[2.2-java] multiselect with databinding example

65 views
Skip to first unread message

Rishi Khare

unread,
Feb 21, 2014, 1:27:04 PM2/21/14
to play-fr...@googlegroups.com
Hi Everyone, 

   I am using play 2.2 with JPA, Spring 4 and Hibernate. I am able to use data binding for Entities with Single Select, by using @select(form("entity.id",options=...)) and it works seamlessly but I am not able to get multiselect working with this, I saw couple of posts on the same topic for play 2.0 version but couldnt understand them properly, I would really appreciate if you can point me to any example/tutorial for the same.

-Thanks

Philip Johnson

unread,
Feb 21, 2014, 8:59:31 PM2/21/14
to play-fr...@googlegroups.com
Hi Rishi,

Here is an example I wrote for Play 2.2; not sure if it addresses your questions or not:


Philip

Rishi Khare

unread,
Feb 23, 2014, 10:59:12 PM2/23/14
to play-fr...@googlegroups.com
Hi Philip,
  Thanks a lot for your response, I have been through your blog earlier and found it very helpful, however I am trying to do things a bit differently.

to use the example from your blog, I do not want to create a separate StudentFormData class but use Student Entity itself to create and populate the values to/from form.

It works very well as long as long as I have only one Major or one Hobby part of student class, that way I can simply call @form("major.id") in view and on server side Student is automatically populated. but If I use List<Hobby> or Set<Major> etc, it doesn't populate the values. I tried using @form("hobby.id") @form("hobby[]") and some other combinations, even tried using a custom binder for Hobbies (Formatter as it is called) but nothing is working.

-Thanks,
Rishi



--
You received this message because you are subscribed to a topic in the Google Groups "play-framework" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/play-framework/eOrpZTSvKr4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to play-framewor...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
-Thanks,
 Rishi
Reply all
Reply to author
Forward
0 new messages