Grails multiple select tag

Date January 6, 2008

I was a bit disheartened to learn that the standard Grails GSP tag for ’select’ didn’t accept a list in the ‘value’ parameter.  This is necessary when building HTML SELECTs with multiple options preselected.   So I wrote a patch, then realized it was already an issue, but hadn’t been looked at since May 07.  I pestered the mailing list, and it might be looked at again for inclusion before the final 1.0 release (fingers crossed!).

This morning I realized that I could just make a new taglib.  It’s not ideal, but what the heck, right?  It gets me over my situation, and can make a slight mod to my code if/when Grails natively  supports this functionality.  In the meantime, I contibuted back my taglib.  It’s mostly a pared down version of the stock FormTagLib.groovy file from Grails already, with non-select functionality removed, and my few extra lines added.  The code is up here if you need this for your next Grails project.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • TailRank
  • YahooMyWeb
  • del.icio.us
  • DZone
  • Facebook
  • Reddit
  • StumbleUpon
  • Digg
  • Simpy
  • Technorati

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">