Use text field value on another text field on same node on save I have two fields on a Content Type called Property that requires the same information and I am trying to have it so that it only needs to be inputted one time be the user.

I am using the module Address Field and Locations and need to fill out the zip codes with the same zip code. I need to get it so I only have to input the zip code one time and it fills both. I have tried a hook form alter (my example below) but the second field does not get the text unless I save the node again. I understand why but I am not sure how to go about fixing this.

function zip_to_zip_form_alter(&amp;$form, $form_state, $form_id) {


switch($form_id) {

  case 'property_node_form':

$form['locations'][0]['#default_value']['postal_code'] = $form['field_address']['und'][0]['#address']['postal_code'];


  break;


}
}

Suggestions welcome. Thanks!
What you are doing is happening in the browser, so drupal, or anything else on the server, obviously doesn't know what's going on until you hit submit.

So you have to use jQuery that is running there in the client, and one way would be along the lines of:

$('#IDOFYOURFIRSTZIPCODE').live('change', function() {
  $('#IDOFYOURSECONDZIPCODE').val($('#IDOFYOURFIRSTZIPCODE').val());
});  


The #IDs will look something like #edit-field-FIELDNAME-0-value but basically what it is doing is changing the second value to the first when the first changes.

Put that in a module's or theme's js and you should be set.  (I suppose you could [should?] add it with a drupal_add_js() right from your form_alter().)

(For those jQuery experts out there, I suppose I should have used on() or delegate() instead of live() but this works on both D6 and D7 with stock jQuery)