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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Form Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

CounrtyDropDownField Nice Output


Go to End


2 Posts   1461 Views

Avatar
zenmonkey

Community Member, 545 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, 791 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 !