WP-Contact Form 7 country list: populate all countries in

Einfach Dinge, die nichts mit XAMPP, Apache Friends, Apache, MySQL, PHP und alle dem zu tun haben. Allerlei halt. ;)

WP-Contact Form 7 country list: populate all countries in

Postby unleash_it » 09. February 2020 12:38

hello at all ,

this thread belongs to the series of talks where we discuss common problems and best practice in the field of Wordpress-sites and their setup.

today: Contact Form 7 country list - methods to populate all countries drop-down & respective states-cities in my contact form

I want to populate all countries drop-down & respective states-cities in my contact form, I'm using Contact Form 7.
i have done some research and found several options to achieve this:

- one option is to populate all county values in shortcode.
- another option is to add country to be selected from drop-down,
only then respective states will be visible & the same logic will go for cities as depending on the states.

plugins and ideas:

- Country drop-down menu for Contact Form 7.
https://de.wordpress.org/plugins/cf7-countries/
with this plugin we will get „countries drop down“ Form tag in CF7. The countries list is the same countries list used by WooCommerce.
- listo: http://contactform7.com/listo/
we used Listo (a wordpress plugin) and added the writing [select countries data:countries] list of contries.

note: I want Get Current country(Find by IP) in cf 7 dropdown.

so the steps to take:

Below I find the country by IP:
Code: Select all
Country[select* countrylist id:Country "Please Select a Country" "United States|USA" "Afghanistan|AFG" "Albania|ALB" "Algeria|DZA" "American Samoa|ASM" ........ ]
(Note: ..... means list all countries defined)

since Contact Form 7 doesn't have a ready country list by default. we can go ahead and do the population of the values on our own:
we can populate all values by ourself: here some methods, options and dataset: cf. https://gist.github.com/MatthewEppelsheimer/1498955

Code: Select all
<?php
/*
UPDATED: December 31, 2011.
Modifications:
- Truncated the longest country names, including:
-- British Indian Ocean Territories (Chagos Archipelago) -> British Indian Ocean Territories
-- South Georgia and the South Sandhich Islands -> South Georgia & S. Sandwich Islands
UPDATED: December 19, 2011.
List taken from http://en.wikipedia.org/wiki/List_of_sovereign_states_and_dependent_territories_by_continent_(data_file)
Modifications:
 - deleted Antarctica
 - removed meta data
 - removed full names following commas
 - sorted by alpha
 - anglo- and North America-centric re-ordering
 - addition of short code wrapper
*/
?>


[select country "United States" "Canada" "Mexico" "United Kingdom" "-----" "Afghanistan" "Albania" 
cf. https://gist.github.com/MatthewEppelsheimer/1498955
see this is a list of countries:
Code: Select all
 [select country "United States" "Canada" "Mexico" "United Kingdom" "-----" "Afghanistan" "Albania" "Algeria" "American Samoa" "Andorra" "Angola" "Anguilla" "Antigua and Barbuda" "Argentina" "Armenia" "Armenia" "Aruba" "Australia" "Austria" "Azerbaijan" "Azerbaijan" "Bahamas" "Bahrain" "Bangladesh" - and so forth  "Yemen" "Zambia" "Zimbabwe"]


Source: https://gist.github.com/MatthewEppelsheimer/1498955

btw: see the solution for swiss-cities: all Swiss Orts (cities/villages)
Code: Select all
 [select Ort size:15 placeholder:_Ort_eingeben "Aadorf" "Aarau" "Aarberg" "Aarburg" "Aarwangen" "Zwieselberg" "Zwingen" "Zwischbergen"]



last but not least herre another plugin:

- Lead info with country for Contact Form 7
https://wordpress.org/plugins/contact-f ... h-country/

Lead info with country for Contact Form 7 is an addon module for the Contact Form 7 plugin. It helps you track the user who fills out a form.
All you need to do is add the [tracking-info] shortcode in the Message body of the contact form 7.

The lead tracking info includes: Form Page URL, Original Referrer, Landing Page, User IP, Country of the User IP and Browser. In order to display the Country it needs the GeoIP Detection plugin that can be found in the WordPress plugin repository. This plugin “provides geographic information detected by an IP adress”. This plugin auto-updates the GeoIP database once a week. This product includes GeoLite data created by MaxMind, available from http://www.maxmind.com. If the GeoIP Detection plugin is not installed and enabled, you will only see the IP address, without the country of the IP adress. We decided to use the GEOIP DETECTION plugin to handle the lookup of the country, because it’s a plugin that is actively developed and we saw no advantage in implementing all this functionality, when we could use an existing one.

The lead tracking info in this plugin includes:

Form Page URL
The URL on which the user filled out the form.

Original ReferrerThe URL from which the user came to your site.

Landing Page
The first page the user visited on your site.

User IP (is not included when using the shorcode [tracking-info-noip])
The IP address of the user who filled out the form.

Country of the IPThe country of the IP address of the user who filled out the form. If the country is 0, please check the FAQ information.

User Agent / Browser
The browser information of the user who filled the form.


question: do you know more options to add populate (all) countries drop-down & respective states-cities into the contact form cf7!?`

i love to hear from you


btw: see more usefull addons and extensions for the cf 7 https://de.wordpress.org/plugins/contact-form-7/

CF7 Customizer
https://de.wordpress.org/plugins/cf7-customizer/

Contact Form 7 Skins
https://de.wordpress.org/plugins/contact-form-7-skins/


Contact Form DB
https://de.wordpress.org/plugins/contact-form-cfdb7/
The „CFDB7“ plugin saves contact form 7 submissions to your WordPress database. Export the data to a CSV file.
By simply installing the plugin, it will automatically begin to capture form submissions from contact form 7.

FEATURES OF CFDB 7

No configuration is needed
Save Contact Form 7 form submitted data to the database.
Single database table for all contact form 7 forms
Easy to use and lightweight plugin
Developer friendly & easy to customize
Display all created contact form 7 form list.
Export CF7 DB (CF7 Database) data in CSV file


further addons:
-CFDB7 DB Switcher
-Drag & Drop File Upload
-Already Submitted?
Trigger error if a field is already submitted
-CF7 Repeater
CF7 Repeater plugin allows creating one or more field dynamically
Popup Message
Replace your validation and success messages into beautiful popup message to attract visitors.
-Export PDF File
Easy to export contact forms from database to PDF file

and also compatible with
Conditional Fields for Contact Form
Fast Secure Contact Form
JetPack Contact Form
Gravity Forms
Enfold Formulare
Formidable Forms
Ninja Forms
Caldera Forms


as mentioned above: this thread belongs to the series of talks where we discuss common problems and best practice in the field of Wordpress-sites and their setup.

have a great day :) :D
for Wordpress-development :: super toolkits a. http://wpgear.org/ :: and b. github.com/miziomon/awesome-wordpress
:: Awesome WordPress: A curated list of amazingly awesome WordPress resources, themes, plugins and shiny things.
User avatar
unleash_it
 
Posts: 224
Joined: 10. December 2011 18:32
Operating System: linux opensuse 12.1

Return to Allerlei

Who is online

Users browsing this forum: No registered users and 3 guests