DrupalBin
Submit Code
About
Recent Posts
Code
4 min 17 sec
ago
css path
1 hour 48 min
ago
Fix for Code
5 hours 48 min
ago
Fix for Code
5 hours 54 min
ago
more
Tags
CCK
drupal
fapi
jquery
menu
module
Panels
php
simpletest
test
theme
views
more tags
User login
Log in using OpenID:
What is OpenID?
Username:
*
Password:
*
Create new account
Request new password
Log in using OpenID
Cancel OpenID login
Home
Fix for Overriding autocomplete functions
View
Download
Fix
This fix will not be saved to the database until you submit.
Summary:
Tags:
Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Source code:
*
var myinput = $('#edit-name1').attr('autocomplete', 'OFF')[0]; var db = new Drupal.ACDB('http://localhost/myproject/?q=my/autocomplete'); var x = new Drupal.jsAC(myinput, db); x.found = function (matches) { // If no value in the textfield, do not show the popup. if (!this.input.value.length) { return false; } // Prepare matches var ul = document.createElement('ul'); var ac = this; for (key in matches) { var li = document.createElement('li'); $(li) .html('<div>'+ matches[key]['display'] +'</div>') .mousedown(function () { ac.select(this); }) .mouseover(function () { ac.highlight(this); }) .mouseout(function () { ac.unhighlight(this); }); li.autocompleteValue = key; li.info = matches[key]['info']; $(ul).append(li); } // Show popup with matches, if any if (this.popup) { if (ul.childNodes.length > 0) { $(this.popup).empty().append(ul).show(); } else { $(this.popup).css({visibility: 'hidden'}); this.hidePopup(); } } } x.select = function (node) { this.input.value = node.autocompleteValue; this.info = node.info; var newdiv = $("<div></div>").addClass("messages status") .html("OK."); $("input#edit-email1").parent().fadeOut("slow").after(newdiv); $("#edit-uid1").val(this.info['uid']); }
Syntax highlighting mode:
ActionScript
ColdFusion
Diff
Drupal
Drupal 5
Drupal 6
HTML
Javascript
MySQL
PHP
Python
robots.txt
SQL
Text
Select the syntax highlighting mode to use.