key Log In or Register to edit

Controls Plugin

This plugin creates controls that can be used to define HTML forms from possible values defined in a topic.

T Wiki Forms allow possible values for a form field to be defined in a topic (see Section "Defining a Form with Multiple Topics"). The same set of values are often used as the values of HTML form controls (e.g., when defining a search where these values are selectable parameters). Using this plugin, these lists of values can be kept synchronized by having the form controls generated based on the topic that defined the values in the first place.

Background: I often found myself defining the possible values for a field of a T Wiki Forms in a TWiki:Codev/TWikiApplication, and then had to manually define the same possible values for a drop down selection or similar in an HTML form. Keeping these consistent was a nuisance. This plugin automates that process.

Syntax Rules

  • Syntax: %CONTROL{form="name"}%
  • can be used to automatically create a HTML form to enter T Wiki Form? data
  • Supported parameters:
    Parameter: Description: Default:
    form="..." The topic containing the form definition (resultes in nothing if there is no form in that topic) Current topic
    createtopic="..." name of topic to create using this form (the 10 X syntax can be used very well for the (eg Control XXXXXXXXXX?)) undefined

  • Syntax: %CONTROLS{"name" ...}%
  • Supported parameters:
    Parameter: Description: Default:
    topic="..." The topic defining the field values Current topic
    web="..." The web from which the topic is taken Current web
    type="..." The control to be rendered. Possible values are select, radio, or checkbox select
    size="..." The size parameter for the control. 1
    urlparam="..." Generates a select option to be passed as URL parameter (valid only with type="select" ). Possible values are on, off off

Example

Below is the definition of the field values for TopicClassifications from T Wiki Forms:

Name Type Tooltip message
NoDisclosure option blah blah...
PublicSupported option blah blah...
PublicFAQ option blah blah...

If this plugins is installed, the variable

%<nop>CONTROL{"firstInput" type="checkbox" size="1"}%

will expand as follows:

Output Expected
%CONTROL{"firstInput" type="checkbox" size="1"}%
NoDisclosure   
PublicSupported   
PublicFAQ   

Plugin Settings

  • One line description, is shown in the Text Formatting Rules topic:
    • Set SHORTDESCRIPTION = This plugin renders a control (typically used in an HTML form) based on values defined in a topic.

  • Debug plugin: (See output in data/debug.txt)
    • Set DEBUG = 0

Plugin Installation Instructions

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

  • Download the ZIP file from the Plugin web (see below)
  • Unzip ControlsPlugin.zip in your twiki installation directory. Content:
    File: Description:
    data/TWiki/ControlsPlugin.txt Plugin topic
    data/TWiki/ControlsPlugin.txt,v Plugin topic repository
    lib/TWiki/Plugins/ControlsPlugin.pm Plugin Perl module
  • (Dakar) Visit configure in your TWiki installation, and enable the plugin in the {Plugins} section.
  • Test if the installation was successful:
    • See if above example rendered correctly

Plugin Info

Plugin Author: TWiki:Main/ThomasWeigert
Plugin Version: 20 Feb 2005 (V1.000)
Change History:  
07 Mar 2006: updated to Dakar, added CONTROLS html form generation - TWiki:Main.SvenDowideit
20 Feb 2005: Initial version
TWiki Dependency: $TWiki::Plugins::VERSION 1.024
CPAN Dependencies: none
Other Dependencies: none
Perl Version: 5.005
TWiki:Plugins/Benchmark: Good Style nn%, Formatted Search nn%, Controls Plugin nn%
Plugin Home: http://TWiki.org/cgi-bin/view/Plugins/ControlsPlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/ControlsPluginDev
Appraisal: http://TWiki.org/cgi-bin/view/Plugins/ControlsPluginAppraisal

Related Topics: T Wiki Forms

-- TWiki:Main/ThomasWeigert - 20 Feb 2005

 
Ad Sponsor
Back to Redbourn
Copyright © We make no guarantee of the correctness of the content of this site. All material on this collaboration platform is the property of Martin Cleaver and the contributing authors.