You are here: Foswiki>System Web>JQueryPlugin>JQueryTextboxList (2025-02-11, UnknownUser)Edit Attach
Homepage: http://foswiki.org/Extensions/JQueryPlugin
Author(s): Michael Daum
Version: 2.30
On this page:
Turns a text input into a list widget with autocompletion. This plugin adds a new formfield type textboxlist to DataForms.
An html input field can be turned into a textboxlist widget either using javascript or using the jqTextboxList css class.
Using javascript:
<input type="text" name="tags" />
<script>
jQuery(function($) {
$("input[name='tags']").textboxlist(options);
});
</script>
Using css and HTML5 data:
<input type="text" name="tags" class="jqTextboxList" data-container-class="..." data-sorting="..." ... />
| Name | Description | Default |
|---|---|---|
| sorting | option to enable sorting of the list of values, can true, false or manual | manual |
| resetControl | jquery selector to specify a reset button; will revert changes to the initial list of values | undefined |
| onSelect | method called when a value is selected | undefined |
| onReset | method called when the list is resetted | undefined |
| onDeselect | method called when a value is removed from the list | undefined |
| onClear | method called when the list is cleared | undefined |
| listValueClass | css class of values in the list | jqTextboxListValue |
| inputName | name of the input element used for list values; equals to the name of the original input field if undefined | undefined |
| enableClose | boolean flag toggling the display of a close button on a list value | true |
| containerClass | css class of the widget container | jqTextboxListContainer |
| closeClass | css class of the close button of a list value | jqTextboxListClose |
| clearControl | jquery selector to specify a clear button that will empty the textboxlist | undefined |
| autocomplete | defines the source for tag suggestions displayed using a %SYSTEMWEB.JQueryUIAutocomplete widget; e.g. this can be an array or an url | undefined |
Instead of specifying callbacks using the onSelect or onDeselect options, custom events are emitted by the textboxlist widget that your own code can be bound to.
Example:
<input type="text" class="jqTextboxList" id="mylist" />
<script>
jQuery(function($) {
$("#mylist").bind("SelectValue", function(value) {
...
});
});
</script>
| Event | Parameters | Description |
|---|---|---|
| SelectValue | value | triggered when a value is selected |
| DeleteValue | value | triggered when a value is deselected |
Note, that you will need FilterPlugin to run the example successfully.
%STARTSECTION{"data"}%%FORMATLIST{
"admin,
backup,
bash,
emulation,
games,
irc,
linux,
mercurial,
patches,
perl,
php,
python,
site,
surfing,
tag,
test,
foswiki,
web,
wiki,
windows,
windsurfing,
wine
"
split="\s*,\s*"
header="["
format="{\"value\":\"$1\"} "
footer="]"
separator=",$n"
include="\s*%URLPARAM{"term"}%.*"
}%%ENDSECTION{"data"}%
Edit | Attach | Print version | History: r1 | Backlinks | View wiki text | Edit wiki text | More topic actions
Topic revision: r1 - 2025-02-11, UnknownUser
Copyright © by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback