|
All,
I've been searching for hours without success. Any help would be appreciated. I have a gsp that allows the person to select a user and multiple roles (user and role are both domains). I want to create multiple userrole entries (also a domain) with all of the user/role combinations in the request params. Contrary to most of my searching, regardless if one or multiple roles are selected and are returned as a string. If there is a single role selection, everything looks OK (eg. "1"), but if there are multiple selected the returned string looks like this: "[1,2]". I've tried params.list("role"), params.role.values() and a number of other fruitless ways to get it so that I can loop over each of the role entries, such as: def selectedroles = params.list("role") selectedroles.each({ r -> println "role id=" + r + " type is "+ r.getClass().name }) Any guidance would be appreciated. Regards, Gene
Regards,
Gene |
|
Put this as first line inside your action:
params.role = params.role instanceof String ? [params.role] : params.role params.role.each{ //Your code goes here.............. } Hope it helps. Regards Gaurav Chauhan On Tue, Nov 15, 2011 at 11:17 PM, gcarbone <[hidden email]> wrote: All, |
|
This was the perfect answer to my problem.
Thank you for your response!
Regards,
Gene |
|
Glad it helped :-)
Regards Gaurav Chauhan On Wed, Nov 16, 2011 at 7:58 PM, gcarbone <[hidden email]> wrote: This was the perfect answer to my problem. |
| Powered by Nabble | Edit this page |
