When I select only one country for a phone field and leave the 'Hide when only one country code' option unchecked, I get the following errors:

Notice: Undefined variable: countrycode in cck_phone_phone_number_validate() (line 816 of /var/www/d7/sites/all/modules/dev/cck_phone/cck_phone.module).
Notice: Undefined variable: countrycode in cck_phone_phone_number_validate() (line 840 of /var/www/d7/sites/all/modules/dev/cck_phone/cck_phone.module).
Notice: Undefined variable: countrycode in cck_phone_phone_number_validate() (line 852 of /var/www/d7/sites/all/modules/dev/cck_phone/cck_phone.module).
Notice: Undefined variable: countrycode in _cck_phone_validate() (line 400 of /var/www/d7/sites/all/modules/dev/cck_phone/cck_phone.module).
Notice: Undefined variable: countrycode in _cck_phone_validate() (line 424 of /var/www/d7/sites/all/modules/dev/cck_phone/cck_phone.module).
Notice: Undefined variable: countrycode in _cck_phone_validate() (line 436 of /var/www/d7/sites/all/modules/dev/cck_phone/cck_phone.module).
Notice: Undefined index: country_codes in _cck_phone_sanitize() (line 487 of /var/www/d7/sites/all/modules/dev/cck_phone/cck_phone.module).

The $phone_input variable is also not initialized in cck_phone_phone_number_validate() so it may also cause issues.

Comments

hermanns’s picture

Get the same error.

rojesaga’s picture

Same here,
I Use the 7.x-1x-dev 2011-Dec-18
Default country code: - Mexico
Not Show all Country codes
Unselected the "Enable contry level validation" (Also try with it)

ERROR - Used as field on Profile 2

Notice: Undefined variable: countrycode en cck_phone_phone_number_validate() (línea 816 de /home/ggarciat/public_html/ideageek.mx/demo/cmh/sites/all/modules/cck_phone/cck_phone.module).
Notice: Undefined variable: countrycode en cck_phone_phone_number_validate() (línea 834 de /home/ggarciat/public_html/ideageek.mx/demo/cmh/sites/all/modules/cck_phone/cck_phone.module).
Invalid country code "" submitted.
Notice: Undefined variable: countrycode en cck_phone_phone_number_validate() (línea 840 de /home/ggarciat/public_html/ideageek.mx/demo/cmh/sites/all/modules/cck_phone/cck_phone.module).
Notice: Undefined variable: countrycode en _cck_phone_validate() (línea 400 de /home/ggarciat/public_html/ideageek.mx/demo/cmh/sites/all/modules/cck_phone/cck_phone.module).
Notice: Undefined variable: countrycode en _cck_phone_validate() (línea 418 de /home/ggarciat/public_html/ideageek.mx/demo/cmh/sites/all/modules/cck_phone/cck_phone.module).
Notice: Undefined variable: countrycode en _cck_phone_validate() (línea 424 de /home/ggarciat/public_html/ideageek.mx/demo/cmh/sites/all/modules/cck_phone/cck_phone.module).

dddbbb’s picture

Same problem for me. Have left all country codes available as a temporary fix.

tommychris’s picture

A little piece of modification, not the best, but in my case, it works, I hope it helps:

cck_phone.module line 764

-          $element['country_codes'] = array(
+          $element['country_codes'] = array(
+            '#type' => 'hidden',
+            '#value' => $v,
+          );
+          $element['country_codes_markup'] = array(
ckng’s picture

Status: Active » Fixed

Mistaken:This has been fixed per #1323726: Make default country code optional
But it has been fixed in the dev.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.