r2 - 18 Mar 2008 - 12:13:02 - TWikiAdminYou are here: TWiki >  TWiki Web > ExtendedSelectPlugin

NOTE: As of TWiki-4.1 the functionality of this plugin is incorporated in the TWiki core. There is no need to install the plugin in TWiki 4.1 or above.

ExtendedSelectPlugin

Adds flags to the select field form type to allow the following features:

  • Multiselect
  • Shrinking a select with size greater than 1 to the number of options if the size is greater than the number of options
  • Allowing for options to have a value that is different than the displayed text

Note: this version of the ExtendedSelectPlugin will not work with TWiki versions prior to Dakar Beta 3 without a patch to Forms.pm, and is completely untested on anything before Dakar Beta 2.


Syntax Rules

When creating a form template, there are three flags that can be added to the select type, and they can be added in any order.

=+multi=
turns multiselect on for the select, to allow Ctrl-Click to select (or deselect) multiple items.
=+shrink=
turns on shrink, which causes the size of the select to be reduced if it is larger than the number of options for the select, though it will not reduce size below 1
=+values=
turns on values, which causes the select to allow for the value and the displayed text in a select to be different.

These options are appended to the select in the type column without a space, so to turn on just multiselect, you would use select+multi instead of just select.

The +values option is the only option that changes anything other than the field type. If it is turned on, then each of the allowed values are checked individually for the presense of an unescaped = character. If this is not found, then that allowed value behaves as if +values weren't turned on. That is to say that the value will be used as both the display text and the value to store in the form. If an unescaped = character is found, then the value is split on the first unescaped = character, the part of the value preceding the unescaped = character is used as the display text, and the part of the value after that is used as the value that is stored in the form.

Examples

Form Field Line
| Name | Type | Size | Values | Tooltip message |
Would Display (approximately) As
| Field 1 | select | 1 | One, Two, Three | normal select |Field 1
| Field 2 | select | 5 | One, Two, Three | normal select, size greater than 1 |Field 2
| Field 3 | select+multi | 5 | One, Two, Three | multiselect |Field 3
| Field 4 | select+shrink | 5 | One, Two, Three | shrinking select |Field 4
| Field 5 | select+shrink | 5 | One, Two, Three, Four, Five, Six | shrinking select |Field 5
| Field 6 | select+values | 5 | One=1, Two=2, Three=3 | select w/seperate values |Field 6
| Field 7 | select+multi+shrink+values | 5 | One=1, Two=2, Three=3 | select/w all options |Field 7
| Field 8 | select+values+shrink+multi | 5 | One=1, Two=2, Three=3 | select/w all options |Field 8
| Field 9 | select+values | 5 | One, Two=2, Three=3=III, Four\=4=IV, Five\=5 | Various values formats |Field 9

Settings

Ths plugin does not use any settings at this time

  • Description:
    • Set SHORTDESCRIPTION = Adds options to the select type in forms

Plugin Installation Instructions

  • Download the ZIP file from the Plugin web (see below)
  • Unzip ExtendedSelectPlugin.zip in your root ($TWIKI_ROOT) directory.
Content:
File: Description:
data/TWiki/ExtendedSelectPlugin.txt Plugin Topic
lib/TWiki/Plugins/ExtendedSelectPlugin.pm Plugin Perl Module

Plugin Info

Plugin Author: TWiki:Main.EricSchwertfeger
Plugin Version: 05 Dec 2005 (V1.10)
Change History:  
29 Dec 2005: updated topic formatting (TWiki:Main.WillNorris)
05 Dec 2005: added value decoding. See Bugs:Item1045. (TWiki:Main.MichaelDaum)
11 Oct 2005: V1.001, fixed editing multiple selects
11 Oct 2005: Initial version
TWiki Dependency: $TWiki::Plugins::VERSION 1.1 and Dakar Beta 3 or later
CPAN Dependencies: none
Other Dependencies: none
Perl Version: 5.005
License: GPL (GNU General Public License)
TWiki:Plugins/Benchmark: GoodStyle nn%, FormattedSearch nn%, ExtendedSelectPlugin nn%
Plugin Home: http://TWiki.org/cgi-bin/view/Plugins/ExtendedSelectPlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/ExtendedSelectPluginDev
Appraisal: http://TWiki.org/cgi-bin/view/Plugins/ExtendedSelectPluginAppraisal

Related Topics: TWikiPlugins, TWiki:Plugins/FormFieldsPlugin

-- TWiki:Main/EricSchwertfeger - 11 October 2005

Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r2 < r1 | More topic actions
 
Pixeon Medical Systems
Pixeon Medical Systems - Todos os direitos reservados. 2019
http://www.pixeon.com.br/