summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2007-10-22 15:48:26 +0000
committerDries Buytaert <dries@buytaert.net>2007-10-22 15:48:26 +0000
commit296f6e9f1166d8623c1d9ed37dc55dbbdc02f5be (patch)
tree012aef0ba703bd04c8dffbea93c4b5b7ddff2d6b /modules
parent923abc794ce79d62fdf0a37923dc927193d87441 (diff)
downloadbrdo-296f6e9f1166d8623c1d9ed37dc55dbbdc02f5be.tar.gz
brdo-296f6e9f1166d8623c1d9ed37dc55dbbdc02f5be.tar.bz2
- Patch #180948 by quicksketch: automatically populate e-mail fields during install.
Diffstat (limited to 'modules')
-rw-r--r--modules/system/system.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/modules/system/system.js b/modules/system/system.js
index 2db886eee..45741e76a 100644
--- a/modules/system/system.js
+++ b/modules/system/system.js
@@ -61,6 +61,31 @@ Drupal.cleanURLsInstallCheck = function() {
};
/**
+ * When a field is filled out, apply its value to other fields that will likely
+ * use the same value. In the installer this is used to populate the
+ * administrator e-mail address with the same value as the site e-mail address.
+ */
+Drupal.behaviors.copyFieldValue = function (context) {
+ for (var sourceId in Drupal.settings.copyFieldValue) {
+ // Get the list of target fields.
+ targetIds = Drupal.settings.copyFieldValue[sourceId];
+ if (!$('#'+ sourceId + '.copy-field-values-processed').size(), context) {
+ // 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);
+ }
+ }
+ });
+ sourceField.addClass('copy-field-values-processed');
+ }
+ }
+}
+
+/**
* Show/hide custom format sections on the date-time settings page.
*/
Drupal.behaviors.dateTime = function(context) {