=== Departamentos y Ciudades de Colombia para Contact Form 7 ===
Contributors: jupa8
Donate link: https://www.jupa.co/
Tags: contact form 7, colombia, cities, departments
Tested up to: 7.1
Requires at least: 6.6
Requires PHP: 7.4
Stable tag: 1.3.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

An addon for Contact Form 7 that lists Colombian departments and cities.

== Description ==

This plugin is an addon for Contact Form 7 that lets you list Colombian departments and cities. To list departments use: `[dycccf7_state department]`. To list cities use: `[dycccf7_city city]`. The city field automatically filters its options based on the department selected in the same form.

= Features =

* Two form-tag types: department dropdown and city dropdown.
* The city list updates automatically to match the selected department.
* Server-side validation confirms the submitted department and city actually belong to the official list, not just that the field isn't empty.
* Script and data are only loaded on pages where the form actually uses these fields.
* Works correctly with multiple form instances on the same page.

== Installation ==

The plugin can be installed in two ways.

= Manual installation =

1. Download and upload the plugin files to the `/wp-content/plugins/departamentos-y-ciudades-de-colombia-para-contact-form-7` directory.
2. Activate the plugin through the "Plugins" screen in WordPress.

= WordPress interface installation =

1. Open the Plugins screen in your WordPress admin and click "Add New".
2. In the search box, type "Departamentos y Ciudades de Colombia para CF7" and press Enter.
3. Click "Install" to install the plugin.
4. Activate the plugin.

== Frequently Asked Questions ==

= How do I add the departments list? =

Use the following form-tag in the Contact Form 7 editor: `[dycccf7_state department]`

= Can I use the departments list on its own? =

Yes, just use the `[dycccf7_state department]` form-tag.

= Can I use the cities list on its own? =

No, the department form-tag is required for the city field to work.

== Screenshots ==

1. The `[dycccf7_state]` and `[dycccf7_city]` form-tags in the Contact Form 7 editor.
2. The department and city dropdowns on the front end.

== Changelog ==

= 1.3.1 =
* Fixed: the plugin's text domain now matches its slug, and internal function names use a consistent prefix.
* Removed the bundled translation files; translations are now handled entirely through translate.wordpress.org.

= 1.3.0 =
* Fixed: forms with more than one instance of the department/city fields no longer collide by sharing the same id; each instance now works independently.
* Fixed: the dropdowns now reset correctly when the form reloads or is added dynamically to the page (AJAX submissions, popups, etc.).
* Fixed: the `id:` option from the CF7 tag editor is now respected and reflected in the HTML.
* Fixed: the city field no longer renders if the form does not also include a department field (previously it stayed permanently disabled and unusable).
* Security: added server-side validation so the submitted department and city actually match the official list (previously only checked that the field wasn't empty).
* Performance: the script and department/city data now only load on pages where the form actually uses these fields, instead of on the whole site.
* Performance: Colombia's data was centralized into a single JSON file, avoiding duplication between PHP and JavaScript.
* Added translation support: the plugin's base language is now English, with Spanish translations included (es_ES and es_CO).

= 1.2.0 =
* Code refactor.
* Added a check for the required CF7 plugin.
* Fixed an error shown when the field is required.

= 1.0.0 =
* Initial release.
