The src code for the tag can be found here. just copy the src into a file named MultiselectTagLib.groovy in the taglib dir.
Directions for use, can be found here
As an example, suppose we had a Statement class which contains multiple payments
class Statement {
String name
Date stmtDate
static hasMany = [payments:Payment]
static constraints = {
payments(nullable:false)
}
}
class Payment {
Double amt
Date txnDate
static constraints = {
amt(nullable:false)
txnDate(nullable:false)
}
}
then the gsp tag to select payments for a statement would look like
<g:select optionKey="id" optionValue="amt" from="${Payment.list()}" name="payments"
value="${statementInstance.payments}" multiple="multiple" />
No comments:
Post a Comment