summaryrefslogtreecommitdiff
path: root/misc/form.js
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-10-16 16:37:01 +0000
committerDries Buytaert <dries@buytaert.net>2009-10-16 16:37:01 +0000
commit4430d46334127c69d5ff97ce2e15475c0fae2654 (patch)
tree0f4d0fd0bb845f0ed14652924fd6921579fcfd98 /misc/form.js
parentf46e6626cd5274f1783fb2f6e0e776b8b43b1a5c (diff)
downloadbrdo-4430d46334127c69d5ff97ce2e15475c0fae2654.tar.gz
brdo-4430d46334127c69d5ff97ce2e15475c0fae2654.tar.bz2
- Patch #440876: missing files.
Diffstat (limited to 'misc/form.js')
-rw-r--r--misc/form.js19
1 files changed, 18 insertions, 1 deletions
diff --git a/misc/form.js b/misc/form.js
index ca572cf38..4b48d3bb0 100644
--- a/misc/form.js
+++ b/misc/form.js
@@ -68,7 +68,6 @@ Drupal.behaviors.multiselectSelector = {
}
};
-
/**
* Automatically display the guidelines of the selected text format.
*/
@@ -86,4 +85,22 @@ Drupal.behaviors.filterGuidelines = {
}
};
+/**
+ * Prepopulate form fields with information from the visitor cookie.
+ */
+Drupal.behaviors.fillUserInfoFromCookie = {
+ attach: function (context, settings) {
+ $('form.user-info-from-cookie').once('user-info-from-cookie', function () {
+ var formContext = this;
+ $.each(['name', 'mail', 'homepage'], function () {
+ var $element = $('[name=' + this + ']', formContext);
+ var cookie = $.cookie('Drupal.visitor.' + this);
+ if ($element.length && cookie) {
+ $element.val(cookie);
+ }
+ });
+ });
+ }
+};
+
})(jQuery);