I'm trying to load 2nd combobox (g:select
) values on the selection of 1st combobox (g:select
) value in GSP.
Domain classes:
class Person {
String name
static hasMany = [telephones:Telephone]
}
class Telephone {
String tNumber
Person person
static belongsTo = [person:Person]
}
GSP:
<td>
<g:select id="person" name="selectedPersonId" from="${Person.list(sort:name, order:asc)}" value="name" optionValue="name" optionKey="id" noSelection="['0':'--Select--']" />
</td>
<td>
<g:select id="telephone" name="selectedTelephoneId" from ="${person.telephones}" value="tNumber" optionValue="tNumber" optionKey="id" noSelection="['0','--Select--']"/>
</td>
How can I do this properly?