Grails multiple select tag

January 6th, 2008 by mgkimsal Leave a reply »

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:
  • del.icio.us
  • DZone
  • Facebook
  • Reddit
  • StumbleUpon
  • Digg
  • Simpy
  • Technorati
Advertisement

Leave a Reply