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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Form Questions /

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

CounrtyDropDownField Nice Output


Go to End


2 Posts   1862 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 !