Grails multiple select binding
Posted by admin - 27/07/09 at 09:07:56 amWhen first time I try to use html select tag with multiple selection, I spent about 1h to figure "how to" because user guide is, hmmm, as is. So, there is my little example:
Lets create domain objects:
Author { String firstName String lastName static hasMany = [books:Book] }
Book { String title static belongsTo = [author:Author] }
Author form will contain select with books like this:
<g:select optionKey="id" optionValue="title" multiple="multiple" name="author.books" id ="author_books" from="${allBooks}" value="${authorInstance?.books*.id}"/>
Multiple select binding to Author.books is now available.
July 27, 2009 | In Grails | 2 Comments
Powered by WordPress with GimpStyle Theme design by Horacio Bella.
Entries and comments feeds.
Valid XHTML and CSS.