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:
<?php
function my_form_user_profile_form_alter(&$form, $form_state, $form_id) {
if ($form_id == 'user_profile_form') {
$form['field_adress']['und'][0]['#required'] = TRUE;
}
}
?>
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
field_adress
incorrectly intentionally?