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).
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:
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.2):
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" onfocus="twiki.Form.clearBeforeFocusText(this);" onblur="twiki.Form.restoreBeforeFocusText(this);" datasection="topiclist" value="Jump" formname="myJumpForm" class="twikiInputField twikiInputFieldBeforeFocus" itemselecthandler="SubmitJump" size="128px" }%</form>
Rendered:
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.2 or later, you can install from the
configure interface (Go to Plugins->Find More Extensions)
- If you have any problems, then you can still install manually from the command-line:
- Download one of the
.zip or .tgz archives
- Unpack the archive in the root directory of your TWiki installation.
- Run the installer script (
perl <module>_installer )
- Run
configure and enable the module, if it is a plugin.
- Repeat for any missing dependencies.
- If you are still having problems, then instead of running the installer script:
- Make sure that the file permissions allow the webserver user to access all files.
- 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)
- Manually edit LocalSite.cfg to set any configuration variables.
|
|
| 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 |
|
|
|
Related Topics: TWikiPlugins,
DeveloperDocumentationCategory,
AdminDocumentationCategory,
TWikiPreferences