The country code select box always reverts to the default rather than showing the saved selection.

Also, if I enter less than 4 digits, I get the following message: "number must be digit only." (It should instead say that not enough digits were entered.)

I'm using CCK 6.x-2.7.

CommentFileSizeAuthor
#2 cck_phone-851184.patch5.29 KBckng

Comments

rubymuse’s picture

I think I fixed this by adding parentheses on line 666 of cck_phone.module:

'#default_value' => isset($element['#value']['country_codes']) ? $element['#value']['country_codes'] : (isset($field['default_country']) ? $field['default_country'] : NULL)

Putting in my vote for this one: #849006: Phone types (home, work, mobile, fax, etc) support

Thanks!

ckng’s picture

Title: Country code selection not displayed » Country code selection not retained
Status: Active » Fixed
StatusFileSize
new5.29 KB

Good catch.

This should be safer

'#default_value' => ($element['#value']['number'] != '' && isset($element['#value']['country_codes'])) ? $element['#value']['country_codes'] : (isset($field['default_country']) ? $field['default_country'] : NULL),

As for the error message, rephrased into

Phone number must be 4-15 digits only.
Phone extension must be less than 6 digits.

Committed to dev.

Status: Fixed » Closed (fixed)

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