r10 - 22 Aug 2007 - 13:59:49 - AndrewRJonesYou are here: TWiki >  Plugins Web > AutoCompletePlugin
Tags:
ajax 1 Add my vote for this tag, forms 2 Add my vote for this tag, twiki_application 2 Add my vote for this tag, usability 2 Add my vote for this tag, user_interface 2 Add my vote for this tag, , create new tag

AutoCompletePlugin

This plugin allows you to create an autocomplete input field based on Yahoo's User Interface Library.

All this plugin does is implement Arthur Clemens' TWiki:Plugins/AutoCompleteAddOn as a plugin, which allows users to provide an autocomplete text box using the %AUTOCOMPLETE% syntax, and also in TWikiForms (shown below).

screenshot.png

Usage

Before you can use this plugin, you need to set up some data for the autocomplete. Examples can be found at AutoCompletePluginTestData.

In Topics and Templates

This plugin expands the %AUTOCOMPLETE{...}% variable, which takes the parameters described in AutoCompletePlugin#Parameters.

In TWikiForms

To use this plugin in TWikiForms, create a form template as descibed in TWikiForms#Defining_a_Form. This plugin adds the autocomplete type of field. To pass the parameters required by the plugin, place them in the Values column. An example is shown below:

Name Type Size Values Tooltip message Attributes
Username autocomplete 25em datatopic="Sandbox.AutoCompletePluginTestData" datasection="usernames" delimchar="," itemformat="item[0] + ' (' + item[1] + ')'"    

You can use many of same attributes as you would in topics, except the following:

  • name
  • size
  • value
  • class
  • formname

Parameters

Parameter Comment Default Example
name A unique name for the textfield required name="users"
datatopic The topic with data. Should be formatted as comma-separated string, or as an array of arrays (see AutoCompletePluginTestData#usernames for an example). Use with datasection. required datatopic="Sandbox.AutoCompletePluginTestData"
datasection The topic section with data. Use with datatopic. required datasection="usernames"
size The width of the input field in em or px. 20em size="20em" or size="200px"
value Default value of the input field none value="AutoCompletePlugin"
tabindex The tabindex of the textfield none tabindex="2"
class Name of css class to add to the input field none class="twikiInputField"
formname Name of the form which the input field is part of none form="userlist"
itemformat The format of an item string in the autocomplete list. Use if the autocomplete list should display different names than the input field - for instance with full person names. The javascript input argument is item. item itemformat="item[0] + ' (' + item[1] + ')'"
delimchar Used to accept multiple delimeted queries. none delimchar=","
onblur, onfocus, onchange, onselect, onmouseover, onmouseout Javascript parameters for the textfield. none onfocus="twiki.Form.clearBeforeFocusText(this);"
itemselecthandler Defines a javascript function to be executed when an item is selected. See http://developer.yahoo.com/yui/autocomplete/#customevents. none itemselecthandler="submitJumpForm"

Example

If installed, the following should create an jump box (TWiki 4.1):

Source:

<script type="text/javascript">
var SubmitJump = function(sType, aArgs) {
    document.myJumpForm.submit();
}
</script>
<form name="myJumpForm" action="%SCRIPTURLPATH{"view"}%/%BASEWEB%/%BASETOPIC%">%AUTOCOMPLETE{ name="topic" datatopic="Sandbox.AutoCompletePluginTestData"  datasection="topiclist" value="Jump" formname="myJumpForm" class="twikiInputField patternFormFieldDefaultColor" onfocus="clearDefaultandCSS(this);" onblur="setDefaultText(this);" itemselecthandler="SubmitJump" size="128px" }%</form>

Rendered:

%AUTOCOMPLETE{ name="topic" datatopic="Sandbox.AutoCompletePluginTestData" datasection="topiclist" value="Jump" formname="myJumpForm" class="twikiInputField patternFormFieldDefaultColor" onfocus="clearDefaultandCSS(this);" onblur="setDefaultText(this);" itemselecthandler="SubmitJump" size="128px" }%

Installation Instructions

You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server where TWiki is running.

Like many other TWiki extensions, this module is shipped with a fully automatic installer script written using the BuildContrib.

  • If you have TWiki 4.1 or later, you can install from the configure interface (Go to Plugins->Find More Extensions)
    • The webserver user has to have permission to write to all areas of your installation for this to work.
  • If you have a permanent connection to the internet, you are recommended to use the automatic installer script
    • Just download the AutoCompletePlugin_installer perl script and run it.
  • Notes:
    • The installer script will:
      • Automatically resolve dependencies,
      • Copy files into the right places in your local install (even if you have renamed data directories),
      • check in new versions of any installed files that have existing RCS histories files in your existing install (such as topics).
      • If the $TWIKI_PACKAGES environment variable is set to point to a directory, the installer will try to get archives from there. Otherwise it will try to download from twiki.org or cpan.org, as appropriate.
      • (Developers only: the script will look for twikiplugins/AutoCompletePlugin/AutoCompletePlugin.tgz before downloading from TWiki.org)
    • If you don't have a permanent connection, you can still use the automatic installer, by downloading all required TWiki archives to a local directory.
      • Point the environment variable $TWIKI_PACKAGES to this directory, and the installer script will look there first for required TWiki packages.
        • $TWIKI_PACKAGES is actually a path; you can list several directories separated by :
      • If you are behind a firewall that blocks access to CPAN, you can pre-install the required CPAN libraries, as described at http://twiki.org/cgi-bin/view/TWiki/HowToInstallCpanModules
  • If you don't want to use the installer script, or have problems on your platform (e.g. you don't have Perl 5.8), then you can still install manually:
    1. Download and unpack one of the .zip or .tgz archives to a temporary directory.
    2. Manually copy the contents across to the relevant places in your TWiki installation.
    3. Check in any installed files that have existing ,v files in your existing install (take care not to lock the files when you check in)
    4. Manually edit LocalSite.cfg to set any configuration variables.
    5. Run configure and enable the module, if it is a plugin.
    6. Repeat from step 1 for any missing dependencies.

Plugin Files

File: Description:
data/TWiki/AutoCompletePlugin.txt Documentation
lib/TWiki/Plugins/AutoCompletePlugin.pm Perl module
data/Sandbox/AutoCompletePluginTestData.txt Test Data
pub/TWiki/AutoCompletePlugin/AutoCompletePluginScreenshot.png Screenshot
lib/TWiki/Plugins/AutoCompletePlugin/Config.spec Spec file for configure

Plugin Info

Plugin Author(s): TWiki:Main.AndrewRJones
Copyright: © 2007, TWiki:Main.AndrewRJones
License: GPL (Gnu General Public License)
Plugin Version: 14585 (22 Aug 2007)
Change History:  
14585 Bugs:Item4468 - Removed extra self-closing div-tag tail; Fixed Jump Form example
14413 Bugs:Item4369 - Allow users to define their own item select handler
14391 Bugs:Item4356 - Class names not being added
14382 Bugs:Item4346 - Added Javascript parameters (onblur, onfocus, etc)
14381 Bugs:Item4345 - Was adding 'null' after input if delimchar not set
14379 Bugs:Item4342 - Only sets correct size for one texfield in topic
14290 Bugs:Item4304 - Various bug fixes and enhancements
14277 Bugs:Item4301 - Initial release
Dependencies:
NameVersionDescription
TWiki::Contrib::YahooUserInterfaceContrib >1.0Optional. If not found, will use files served from Yahoo! servers. See http://developer.yahoo.com/yui/articles/hosting/.
Benchmarks: GoodStyle nn%, FormattedSearch nn%, AutoCompletePlugin nn%
Plugin Home: http://twiki.org/cgi-bin/view/Plugins/AutoCompletePlugin
Feedback: http://twiki.org/cgi-bin/view/Plugins/AutoCompletePluginDev
Appraisal: http://twiki.org/cgi-bin/view/Plugins/AutoCompletePluginAppraisal

Related Topics: TWikiPlugins, DeveloperDocumentationCategory, AdminDocumentationCategory, TWikiPreferences

Topic attachments
I Attachment Action Size Date Who Comment
elsemd5 AutoCompletePlugin.md5 manage 0.2 K 22 Aug 2007 - 13:59 AndrewRJones  
ziptgz AutoCompletePlugin.tgz manage 36.1 K 22 Aug 2007 - 13:58 AndrewRJones  
zipzip AutoCompletePlugin.zip manage 39.3 K 22 Aug 2007 - 13:57 AndrewRJones  
pngpng AutoCompletePluginScreenshot.png manage 9.1 K 25 Jun 2007 - 14:45 AndrewRJones Screenshot
elseEXT AutoCompletePlugin_installer manage 32.3 K 22 Aug 2007 - 13:59 AndrewRJones  
Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r10 < r9 < r8 < r7 < r6 | More topic actions
 
Powered by TWiki
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback SourceForge.net Logo