In my domain class, i have one enum:-
class Product{
Type type
enum Type{
MEDICINE, NON_MEDICINE
}
}
By generating default view, this shows as a dropdown in create.gsp page. My requirement is to show it as a radio group in create page from where i can select any one of the two values by clicking on radio button. can anyone provide some help. thnks
This should work:
<g:radioGroup name="type"
values="${test.Product$Type?.values()}"
labels="${test.Product$Type.values()*.name()}"
value="${productInstance?.type?.name()}">
${it.radio} <g:message code="${it.label}" />
</g:radioGroup>
That should replace the current g:select
in grails-app/views/product/_form.gsp
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With