Index: install.php =================================================================== RCS file: /cvs/drupal/drupal/install.php,v retrieving revision 1.178 diff -u -r1.178 install.php --- install.php 8 Jun 2009 04:33:35 -0000 1.178 +++ install.php 27 Jun 2009 18:03:35 -0000 @@ -727,7 +727,7 @@ drupal_add_js('misc/timezone.js'); // We add these strings as settings because JavaScript translation does not // work on install time. - drupal_add_js(array('copyFieldValue' => array('edit-site-mail' => array('edit-account-mail'))), 'setting'); + drupal_add_js(array('copyFieldValue' => array('edit-site-mail' => array('blur' => array('edit-account-mail')))), 'setting'); drupal_add_js('jQuery(function () { Drupal.cleanURLsInstallCheck(); });', 'inline'); // Build menu to allow clean URL check. menu_rebuild(); Index: modules/system/system.js =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.js,v retrieving revision 1.27 diff -u -r1.27 system.js --- modules/system/system.js 20 Jun 2009 08:02:29 -0000 1.27 +++ modules/system/system.js 27 Jun 2009 18:04:28 -0000 @@ -60,20 +60,24 @@ Drupal.behaviors.copyFieldValue = { attach: function (context, settings) { for (var sourceId in settings.copyFieldValue) { - // Get the list of target fields. - targetIds = settings.copyFieldValue[sourceId]; - if (!$('#'+ sourceId + '.copy-field-values-processed', context).size()) { - // Add the behavior to update target fields on blur of the primary field. - sourceField = $('#' + sourceId); - sourceField.bind('blur', function () { - for (var delta in targetIds) { - var targetField = $('#'+ targetIds[delta]); - if (targetField.val() == '') { - targetField.val(this.value); + // Get the list of events + eventNames = settings.copyFieldValue[sourceId]; + for (var eventName in eventNames) { + // Get the list of target fields. + targetIds = settings.copyFieldValue[sourceId][eventName]; + if (!$('#'+ sourceId + '.copy-field-values-processed', context).size()) { + // Add the behavior to update target fields on blur of the primary field. + sourceField = $('#' + sourceId); + sourceField.bind(eventName, function () { + for (var delta in targetIds) { + var targetField = $('#'+ targetIds[delta]); + if (targetField.val() == '') { + targetField.val(this.value); + } } - } - }); - sourceField.addClass('copy-field-values-processed'); + }); + sourceField.addClass('copy-field-values-processed'); + } } } }