1.12.0
1.12.0 - Gravity Forms 3.1.0.3 Address field compatibility fix
The problem
Since Gravity Forms 3.0.3, the Address field's Country value changed from the full country name (e.g. "Australia") to an ISO 3166-1 alpha-2 code (e.g. "AU"). On sites running Gravity Forms 3.1.0.3 with this plugin, that change broke the State/Province field on Address fields: it would remain hidden (visibility: hidden) and its value would never be saved, regardless of which Address Type was configured (International, US, or Canadian). Because State was a required field, this could result in address submissions being rejected or saved with missing/invalid address data.
The cause was a mismatch between the new Country value format from Gravity Forms and the CiviCRM state/province lookup table this plugin builds, which was still keyed only by country name. A related bug in the same area could also cause the State field's "required" validation to be silently and incorrectly relaxed for every country.
Gravity Forms' Country value change also affected any Add-On Framework based integration (such as the Webhooks add-on) that maps the Address field's Country sub-field: values sent to third-party endpoints switched from the country name to the ISO code without notice.
Fixed
- State/Province field no longer hides itself. The CiviCRM states lookup used by the front-end script is now keyed by both the country's ISO code and its full name, so it matches whichever value Gravity Forms provides.
- State "required" validation relaxation bug fixed. The server-side check that relaxes the State field's required validation for countries with no states in CiviCRM was matching against the country name only; it now checks the ISO code first, falling back to name.
- Hardened the Address field JS against a missing/unmatched Country element, so one unexpected case can no longer abort processing of every other Address field on the same form. Removed unused/dead code in the same file.
New: Address Field - Country Value setting
A new global setting has been added to Forms → Settings → CiviCRM Settings: Address Field - Country Value, letting you choose whether the Country value sent to the Gravity Forms Webhooks add-on is:
- Country Name (e.g.
"Australia") — restores the behaviour prior to Gravity Forms 3.0.3. This is the default. - Country ISO Code (e.g.
"AU") — Gravity Forms' native behaviour since version 3.0.3.
This setting is scoped specifically to the Webhooks add-on and does not affect other Add-On Framework based integrations (e.g. Stripe, EWAY), which continue to receive Gravity Forms' native value unchanged.
Upgrade notes
- Existing installations are automatically migrated on update: the new setting is explicitly saved as Country Name, so your webhooks keep sending the country name as they did before Gravity Forms 3.0.3, with no action required.
- If you want webhooks to send the ISO code instead going forward, change the setting on the CiviCRM Settings page after updating.
- Note: this fix applies to the Webhooks add-on's field mapping. If a webhook feed uses "Send All Fields" mode, or a custom value with a merge tag using the
:codemodifier, those are unaffected by this setting.
Full Changelog: 1.11.7...1.12.0