0

I've just started working with the cf-civicrm plugin so I may be missing something simple.

I can't get the CiviCRM State/Province select field to fill. I tested it using the "CiviCRM Contact and Address" form template after running into the issue on a form I was building. No luck. The field just returns N/A for every country I've tried.

My experience has some parallels to this github issue but the fix that worked for rbaugh isn't working for me.

Questions, tip and pointers about how to resolve this would be most welcome.

Thanks!

4

This type of problem commonly occurs when any of these is true:

  1. No default country is set
  2. No default state is set
  3. Available countries is not set - list on right-hand side is empty
  4. Available states is not set - list on right-hand side is empty

Check your CiviCRM Localisation Settings. Below is a screenshot of a working configuration for a site in Australia that allows both Australia and USA country/state options to be selected.

CiviCRM Localisation Settings

2
  • Thanks, Justin, for your quick response. I have all of these set in my Localization Settings and the issue still persists. Any thoughts on where to look next? – rgilman Oct 9 '20 at 3:42
  • As I describe in my answer below, I found that available countries and available states were the issue but default country or state had no effect, at least in my case. – rgilman Oct 9 '20 at 15:31
2

I have it working and, at least in my case, the issue is with the handling of available countries and available states as rbaugh describes in this github issue. Essentially, if you leave the right-hand box empty to include all countries (as the CiviCRM note directs), none of the states are loaded. Loading all of the countries into both right-hand boxes works.

Commenting out the foreach loop from lines 293 to 297 in cf-civicrm/includes/class-civicrm-caldera-forms-helper.php allows the fields to work in the form with the available countries right-hand box empty (with the available states empty as well).

My usage is worldwide. I need all the countries so this hack works for me but it looks like the logic around that foreach loop needs some refinement.

Along the way I did some tests.

  • It works fine with no default country or state. Only the available countries and available states mattered. (See Justin Freeman's reply above.)
  • Since I have only one pair of Country/State fields, the CiviCRM Country field in the State field parameter list has no effect. (See Kevin Cristiano's reply above.)

I'll report what I'm finding on the cf-civicrm github site.

1

Making sure that Localisation is set is the first step.

On the form itself, you need to define a country field:

Country Field

and then the State/Province Field. In the State Field be sure you are linking to the Country Field:

enter image description here

1
  • Thanks, Kevin, for your reply. As I describe in my answer below, I found that the CiviCRM Country field made no difference since I have only one Country/State pair in the form. – rgilman Oct 9 '20 at 15:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.