FormFieldsPlugin
Control the appearance and capability of fields in forms when editing. If Javascript isn't enabled then the form field will fall back to being a text box or if it is a built in TWiki type, the relavent HTML control.
Syntax Rules
New types for forms
- colorchooser - still early days for this one
- select multi="twopane" - multi-select list box, can take special value of $users (users/groups from Main)
Examples
This example can be placed in a topic called
WebPreferencesForm
| Name |
Type |
Size |
Values |
Tooltip message |
Attributes |
| WEBTOPICLIST |
textarea |
60x5 |
|
List of key topics in this Web |
S |
| NOSEARCHALL |
radio |
2 |
,on |
|
S |
| WEBBGCOLOR |
colorchooser |
10 |
#C0C0C0 |
Web specific background color: (is overwritten by web preferences) |
S |
| DENYWEBVIEW |
select multi="twopane" |
1 |
$users |
Users or groups who are not allowed to view topics in this Web. |
S |
| ALLOWWEBVIEW |
select multi="twopane" |
1 |
$users |
Only these users or groups are allowed to view topics in this Web. |
S |
| DENYWEBCHANGE |
select multi="twopane" |
1 |
$users |
Users or groups who are not allowed to edit topics in this Web. |
S |
| ALLOWWEBCHANGE |
select multi="twopane" |
1 |
$users |
Users or groups who are allowed to edit topics in this Web. If empty all but those listed in DENYWEBCHANGE are allowed |
S |
| DENYWEBRENAME |
select multi="twopane" |
1 |
$users |
Users or groups who are not allowed to rename topics in this Web. |
S |
| ALLOWWEBRENAME |
select multi="twopane" |
1 |
$users |
Users or groups who are allowed to rename topics in this Web. If empty all but those listed in DENYWEBRENAME are allowed |
S |
| ALLOWTOPICCHANGE |
select multi="twopane" |
1 |
$users |
Users or groups who are allowed to change this topic. If empty all but those listing in DENYTOPICCHANGE are allowed |
S |
or in form you can use directly in
WebPreferences
| *Name* | *Type* | *Size* | *Values* | *Tooltip message* | *Attributes* |
| WEBTOPICLIST | textarea | 60x5 | | List of key topics in this Web | S |
| NOSEARCHALL | radio | 2 | ,on | | S |
| WEBBGCOLOR | colorchooser | 10 | #C0C0C0 | Web specific background color: (is overwritten by web preferences) | S |
| DENYWEBVIEW | select multi="twopane" | 1 | $users | Users or groups who are not allowed to view topics in this Web. | S |
| ALLOWWEBVIEW | select multi="twopane" | 1 | $users | Only these users or groups are allowed to view topics in this Web. | S |
| DENYWEBCHANGE | select multi="twopane" | 1 | $users | Users or groups who are not allowed to edit topics in this Web. | S |
| ALLOWWEBCHANGE | select multi="twopane" | 1 | $users | Users or groups who are allowed to edit topics in this Web. If empty all but those listed in DENYWEBCHANGE are allowed | S |
| DENYWEBRENAME | select multi="twopane" | 1 | $users | Users or groups who are not allowed to rename topics in this Web. | S |
| ALLOWWEBRENAME | select multi="twopane" | 1 | $users | Users or groups who are allowed to rename topics in this Web. If empty all but those listed in DENYWEBRENAME are allowed | S |
| ALLOWTOPICCHANGE | select multi="twopane" | 1 | $users | Users or groups who are allowed to change this topic. If empty all but those listing in DENYTOPICCHANGE are allowed | S |
FormFieldsPlugin Global Settings
Plugin settings are stored as preferences variables. To reference a plugin setting write
%<plugin>_<setting>%, i.e.
%INTERWIKIPLUGIN_SHORTDESCRIPTION%
- One line description, is shown in the TextFormattingRules topic:
- Set SHORTDESCRIPTION = Control the appearance and capability of fields in forms when editing.
- Debug plugin: (See output in
data/debug.txt)
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
FormFieldsPlugin.zip in your twiki installation directory. Content: | File: | Description: |
data/TWiki/FormFieldsPlugin.txt | Plugin topic |
data/TWiki/FormFieldsPlugin.txt,v | Plugin topic repository |
lib/TWiki/Plugins/FormFieldsPlugin.pm | Plugin Perl module |
templates/formfields.tmpl | Contains the basic HTML that is used in the edit controls |
- Test if the installation was successful:
Brief design notes
I wanted to use the richness of Javascipt, but still be functional without. I'm fairly pleased with the approach, but I'm not sure it's fully correct.
- If Javascript is enabled then
initForm is called when the edit window appear on the client. This hides the default textboxes and shows the new edit controls.
- Values are always sent to TWiki in the normal text boxes (or other standard controls)
- Painful differences between browers caused me some grief, not sure if I've got it right
- Code for this is within
edit.tmpl
- Most of the HTML and JavaScript for this plugin is to be found within different sections of the
formfields.tmpl template. So you can alter a fair a bit of the controls behaviour by making changes there.
Known issues
- The colour chooser option is just about okay in IE, but useful in Netscape
- This whole plugin is somewhat experimental
Plugin Info
Related Topics: TWikiPreferences,
TWikiPlugins,
TWiki:Codev/ExtendingFormControls
--
TWiki:Main/JohnTalintyre
- 04 Jun 2003