I'm having a tough time creating a drop down menu for an array list of objects. The bottom example shows what I want to do. I was able to make a drop down populated with an array of objects. The top example won't behave the same way. The objects are structured almost identically.
<g:select name="module.id"
from="${moduleInstance}"
value="${moduleInstance?.id}"
optionKey="id"
optionValue="${{"${it.name}"}}"
noSelection="['':'Please select']"
required="" />
<g:select name="division.id"
from="${divisionInstance}"
value="${personInstance?.division?.id}"
optionKey="id"
optionValue="${{"${it}"}}"
noSelection="['':'Please select']"
required="" />
I think it's because you have your array in from (ie moduleInstance) in value attribute too (ie moduleInstance?.id). If moduleInstance is an array then you are saying I'm select everything in that array which leads to a multi-selection select box instead of a drop down.
Try changing your value attribute to value="${moduleInstance[0]?.id}" just to try it out, and see if that renders a single selection combo box.