Cant make postal code only required I am using the adress field module and like to make only the postal code field required.
The rest of the fields i like to hide.

The hiding of the fields are no problem however i am having problems with making only the postalcode field required.
I can hide the whole field with:

&lt;?php
 function my_form_user_profile_form_alter(&amp;$form, $form_state,  $form_id) {                

  if ($form_id == 'user_profile_form') {

  $form['field_adress']['und'][0]['#required'] = TRUE;
      }
    }
      ?&gt;


but then this is not working

$form['field_adress']['und'][0]['locality_block']['postal_code']['#required'] = TRUE;


What am i missing?
Without succes i have tried solutions as:
In here
and here
You can make the address field not-required and write a custom validate function to check for the postal code. Like this: 

&lt;?php
function my_form_user_profile_form_alter(&amp;$form, $form_state,  $form_id) {                
  if ($form_id == 'user_profile_form') {
      $form['field_adress']['und'][0]['#required'] = FALSE;
      array_unshift($form['#validate'], '_my_postal_validate');
  } 
}

function _my_postal_validate(&amp;$form, &amp;$form_state) {
    if (strlen($form_state['values']['field_adress']['und'][0]['postal_code']) &lt; 2) {
        form_set_error('field_address', t('You must enter a postal code'));
    }
}
?&gt;


See form_set_error to set better form errors.

If you support non US addresses (without a postal code), make sure the postal_code is available or you'll get warnings.