Skip to content

Commit

Permalink
Merge pull request grails#1 from nvaidyan/master
Browse files Browse the repository at this point in the history
Update select tag docs to show what else optionKey/optionValue can do
  • Loading branch information
bobbywarner committed Oct 24, 2011
2 parents 3eeb9d0 + fd5f2ba commit 6d684ac
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/en/ref/Tags/select.gdoc
Expand Up @@ -77,6 +77,14 @@ If you require even more control over how each @<option>@ element is presented t
name="book.title" from="${bookList}" />
{code}

This can work nicely for when you want to pre-select a value from the list on form load.
For example, assume we are passing in a @favoriteBook@ variable corresponding to an object in the @from@ which should be pre-selected.

{code}
<g:select optionKey="id" value="${favoriteBook.id}"
name="book" from="${bookList}" />
{code}

h2. Source

{source:tag=FormTagLib.select}
Expand Down

0 comments on commit 6d684ac

Please sign in to comment.