Is there any way to show more than one field name in optionValue?
<g:select name="id" from="${Books.list()}" optionKey="id"
value="" optionValue="name"
noSelection="${['null':'Select Publisher...']}"/>
Expe:
<g:select name="id" from="${Books.list()}" optionKey="id"
value="" optionValue="name and author"
noSelection="${['null':'Select Publisher...']}"/>
You can pass a closure for your option value if you don't want to modify your domain class:
<g:select name="id" from="${Books.list()}" optionKey="id"
value="" optionValue="${{it.name +' '+it.author}}"
noSelection="${['null':'Select Publisher...']}"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With