Grails countrySelect tag - default value -
this code
<g:countryselect name="country" value="${customerinstance?.country}" noselection="['':'-choose country-']"/>
in show view(page) displays value, instead of want display selected option
for example, -choose country- afghanistan albania here in above example want show page display option ("afghanistan") instead of value ("alg"), question me out of problem
you have override countryselect tag or create own.
import org.codehaus.groovy.grails.plugins.web.taglib.countrytaglib class formstaglib { static namespace = "bootstrap" closure countryselect = { attrs -> if (!attrs.from) { attrs.from = countrytaglib.country_codes_by_name_order } if (!attrs['valuemessageprefix']) attrs.optionvalue = { countrytaglib.iso3166_3[it] } attrs.optionkey = { countrytaglib.iso3166_3[it] } if (!attrs.value) { attrs.value = attrs.remove('default') } out << select(attrs) } }
and call
<bootstrap:countryselect name="country" value="${customerinstance?.country}" noselection="['':'-choose country-']"/>
try this..,.
Comments
Post a Comment