How to write parameters so that I can generate them in HTML select? The problem with this "options" requires a set, not an array
That is all that I have. I know that the naming convention is bad, and I will fix it, but now I have been dealing with this problem for several days now.
Controller class
import org.springframework.dao.DataIntegrityViolationException
import grails.plugin.mail.*
class EmailServiceController {
static defaultAction = "contactService"
def contactService() {
def options = new ArrayList()
options.push("Qestions about service")
options.push("Feedback on performed service")
options.push("Other")
options.push("Why am I doing this")
options
}
def send() {
sendMail(){
to "mygroovytest@gmail.com"
from params.email
subject params.subject
body params.information
}
}
}
Domain class
class EmailService {
static constraints = {
}
}
g: select call from gsp
<g:select name = "subject" from = "${options}" noSelection="Topic"/>
also tried the following with "$ {selectOptions}" instead of "$ {options}" with no luck
def selectOptions() {
def options = new ArrayList()
options.push("Qestions about service": "QAS")
options.push("Feedback on performed service":"FoPS")
options.push("Other":"Other")
options.push("Why am I doing this":"WHY")
return options
}
source
share