• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Default a g:checkBox to checked?

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, Ive been fighting this for a while and cannot figure it out. I'm new to Grails, so have mercy.

I have a need to set a checkbox as checked as the default. I've been able to get the checkbox to work with my query when I leave it as unchecked as default.

My checkbox definitions is:



I have tried setting the "checked" attribute and I've tried various permutations of setting the params.areDuplicatesExcluded in my controller. But so far, everything I have tried either has no effect at all, or sets the parameter to checked no matter how the box is set.

I know this should be easy, but I have hit a brick wall.

Any help would be appreciated. How do I default the checkbox to checked and still get it to work?
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<g:checkBox name="areDuplicatesExcluded" value="true" checked="${params.areDuplicatesExcluded}"/>
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic