Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Form Questions /

CounrtyDropDownField Nice Output


Reply


2 Posts   1161 Views

Avatar
zenmonkey

Community Member, 528 Posts

25 August 2009 at 8:39am

I have a CountryDropDownField in a form. However it stores the data as a 2 character country code. Is there anyway to either save the Data as a proper country name or Render it in the Template as such similar to how $Date.Nice outputs a non-numerical Date.

Avatar
Fuzz10

Community Member, 787 Posts

2 October 2009 at 11:01pm

Hi,

have a look at http://api.silverstripe.com/default/Geoip.html

and you will find the method countryCode2name ( $code) to convert it to a nice name.

good luck !