Hello how can I set to this dropdown menu to have default value Second from the list?Here is the dropmenu
<g:select name="dropmenu" from="${["First", "Second", "Third"]}"
/>
Hello how can I set to this dropdown menu to have default value Second from the list?Here is the dropmenu
<g:select name="dropmenu" from="${["First", "Second", "Third"]}"
/>
<g:select selected="Second" name="dropmenu" from="${["First", "Second", "Third"]}"
/>
You are missing the value= attribute. Below is an example that also shows the noSelection option for when the value is null.
<g:select id="initialOutcome" name="initialOutcome.id" optionKey="id" from="${OutcomeDescription.findAll())}"
value="${outcome?.initialOutcome?.id}" noSelection="['':'-Select-']" class="form-control" title="Initial Outcome" required=""/>