I'm using the postal address module to obtain a user's postal address when they register on the site. The registration form is created by a custom module I made.
I'm able to get the form to display the postal address fields correctly (they modify based on your country, etc.), but when I go to process the form in HOOK_submit(), I hit a problem.
The submit function adds the user entity and puts the correct information in for the user. It also creates a new line in the field_data_field_postal_address table in the db as it should. But the address fields are all empty.
I think it is very close to working, but I suspect that something is wrong with the structure of the array I'm passing in to the 'field_postal_address' custom entity field.
function user_registration_form_submit($form, &$form_state){
drupal_set_message("User registration submitted");
dsm($form_state);
$edit = array(
'name' => $form_state['values']['name'],
'pass' => $form_state['values']['password'],
'mail' => $form_state['values']['mail'],
'init' => $form_state['values']['mail'],
'field_postal_address' => array(LANGUAGE_NONE => array(array('value' => $form_state['values']['address']))),
'status' => 1,
'access' => REQUEST_TIME,
);
$newUser = user_save(drupal_anonymous_user(), $edit);
}
So, the question is, why is this function injecting an empty row of data into the field_postal_address field?