Category Covered

Grails item selected on select option

Grails item selected on select option

 

You can select item on option by using value on select option

 

Here if load a form on first time then "My Item" will be selected else the passing value will be selected

 

<g:select id="payment_term" name="payment_term.id" from="${bv.PaymentTerms.list()}" optionKey="id" required="" value="${(vendorMasterInstance?.payment_term?.id)?(vendorMasterInstance?.payment_term?.id):'My Item'}" class="many-to-one"/>