FORMfields, the premiere web framework
Login
Support Home | Knowledge Base | Documentation | Forums | Contact Us
Info
FORMfields & FORMgen :: Field Customizations

Changing the Order of the Entries in the CountryField or StateField

(1194 views. Last Updated: 2007-08-13 7:13 PM)

Here is how to change the order in the CountryField. The same method can be applied to the StateField:
In this example we will move Algeria to the top of the list:
Edit /FORMfields/src/fields/CountryField.php and replace:
var $COUNTRIES = array("Afghanistan", "Albania", "Algeria", "American Samoa", ...
var $COUNTRY_ABBREVIATIONS = array("AF", "AL", "DZ", "AS", ...
with:
var $COUNTRIES = array("Algeria", "Afghanistan", "Albania", "American Samoa", ...
var $COUNTRY_ABBREVIATIONS = array("DZ", "AF", "AL", "AS", ...

Alternatively, you can also do this on a per form basis by editing your form and using something like:
...
$ffForm->addField(new CountryField("country", "Country",  REQUIRED, "[Select One]"));
$ffForm->formFields["country"]->COUNTRIES = array("Afghanistan", "Albania", "Algeria", "American Samoa", ... 
$ffForm->formFields["country"]->COUNTRY_ABBREVIATIONS = array("AF", "AL", "DZ", "AS", ... 
...
Info
Support | Earn Money
Copyright © 2005-2019 Brain Book Software LLC.
Built with FORMfields, the premiere web framework.