同じ要件があり、上記のコードを使用して開始しました。残念ながら、上記のコードは複数の国の選択を考慮していないため、国固有のフィールド(州、州など)の動的フィールドの性質を考慮に入れています。住所フィールドに事前入力するための新機能を組み合わせましたが、適切な国に切り替えることができました。
パッチを書いたmrfeltonから、これを行う方法に関するコードのスニペットを受け取りましたdrupal commerceの同様の住所入力機能の。そのインスピレーションをありがとう。
これが、フィールドアドレスデータを事前入力するために使用した私の関数です。これを改善し、コミュニティに還元してください。
    //method to prepopulate the address field including switching to the right country context
function field_prepopulate_field_widget_form_alter(&$element, &$form_state, $context) {
    // Forms where the pre-population is supposed to occur
    $validforms = array(
            "job_listing_node_form",
            "job_editing_node_form",
            "some_other_node_form"
    ); 
    // Check that I am on the right form
    if(in_array($form_state['build_info']['form_id'], $validforms)) {
        // Check that I am changing the right field
        if($context['field']['field_name'] == 'field_address') {
            global $user;
            $user_fields = user_load($user->uid);
            if (isset($user_fields->field_address) && !empty($user_fields->field_address)) {
                // use field_get_items function to avoid the entire language nonsense (tongue-in-cheek) in the array
                $address_data = field_get_items('user', $user_fields, 'field_address');
                //This may look redundant but is important - fill the address fields out once so that the right country is set
                foreach($address_data[0] as $key => $value) {
                    $context['items'][$context['delta']][$key] = $value;
                }
                // regenerate the widget so that the right country specific fields are rendered
                $format = addressfield_field_widget_form($context['form'], $form_state, $context['field'], $context['instance'], $context['langcode'], $context['items'], $context['delta'], array());
                // Switch out the form elements with our newly generated ones.
                foreach ($element as $key => $value) {
                    if (isset($format[$key])) {
                        $element[$key] = $format[$key];
                    }
                }
                // Set the detault values.
                $element['#address'] = $address_data[0];
            }
        }
    }
}