Skip to content

Commit

Permalink
Item690: update to Foswiki
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk/FormPlugin@1827 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
ArthurClemens authored and ArthurClemens committed Jan 7, 2009
1 parent 06d0c55 commit 2105d03
Show file tree
Hide file tree
Showing 11 changed files with 88 additions and 146 deletions.
35 changes: 16 additions & 19 deletions data/TWiki/FormPlugin.txt → data/System/FormPlugin.txt
Expand Up @@ -2,24 +2,22 @@
%IF{"defined Name and $ Name != ''" then="---+!! Hello %URLPARAM{"Name"}%!" else="---+!! Form Plugin"}%
*Lets you create simple and advanced web forms.*

*Note:* for TWiki versions before 4.2, form POSTs are converted to GETs. This means that all form values will be visible in the browser url, and that there is a limit to the amount of data sent.

%TOC%

---++ Main features
* No html knowledge required to create forms
* Add input fields, textareas, dropdown select boxes, checkboxes, radio buttons
* Set preselected values
* Create a uniform layout
* Call TWiki scripts (view, edit, upload, save) or custom scripts
* Call Foswiki scripts (view, edit, upload, save) or custom scripts
* Use entered field values as variables
* Validate the form before it performs its action
* Usability tested error feedback
* Add Javascript functions for advanced interaction

Example of validation error feedback:

<div class="twikiImage"><img src="%ATTACHURLPATH%/screenshot_validation_example.png" alt="Example of validation error feedback" width='738' height='535' /></div>
<div class="foswikiImage"><img src="%ATTACHURLPATH%/screenshot_validation_example.png" alt="Example of validation error feedback" width='738' height='535' /></div>


---++ Introduction
Expand Down Expand Up @@ -135,8 +133,8 @@ Most parameters are optional. See below for a detailed explanation.
| =anchor= | The anchor link the form should be linked to after submission. If not set the default notification anchor link is used to directly point to possible problems. |- |=FormPluginNotification= | =anchor="MyForm"= |
| =method= | GET or POST ([[http://www.cs.tut.fi/~jkorpela/forms/methods.html][What's the difference?]]) |- | =GET= | =method="POST"= |
| =redirectto= | Redirect topic after form action has been performed. Only for scripts that understand the =redirectto= parameter such as =edit= and =save=. Use the =Webname.TopicName= syntax. |- |- | =redirectto="Main.WebHome"= |
| =formcssclass= | The CSS class of the form container. Use TWiki's =twikiFormSteps= class together with =twikiFormStep= for elements to divide the form in steps. |- |- | =formcssclass="twikiFormSteps"= |
| =elementcssclass= | The CSS class of the element container. Use TWiki's =twikiFormStep= class to divide the form in steps. |- |- | =elementcssclass="twikiFormStep"= |
| =formcssclass= | The CSS class of the form container. Use CSS classes =foswikiFormSteps= and =foswikiFormStep= for elements to divide the form in steps. |- |- | =formcssclass="foswikiFormSteps"= |
| =elementcssclass= | The CSS class of the element container. Use CSS class =foswikiFormStep= class to divide the form in steps. |- |- | =elementcssclass="foswikiFormStep"= |
| =noformhtml= | When set to =on= no form html will be written to the page. This is useful to set form parameters for form elements that use a different form, for instance with Foswiki:Extensions.CommentPlugin. |- |- | =noformhtml="on"= |
| =onSubmit= | Function call that is invoked when the user has pressed the submit button of a form. This event happens just before the form is submitted, and your function can return a value of false in order to abort the submission. Note that the function call should include =(this)=. |- |- | =onSubmit="return notify(this)"= |

Expand Down Expand Up @@ -191,7 +189,7 @@ Use =%<nop>URLPARAM{"element_name"}%= to retrieve the value of a submitted form
| =format= | See [[#Formatting][Formatting]] below. ||||
| =fieldformat= | See [[#Formatting][Formatting]] below. ||||
| =titleformat= | See [[#Formatting][Formatting]] below. ||||
| =cssclass= | CSS class for the element |- |TWiki CSS classes: =twikiInputField=, =twikiSubmit= | =cssclass="myButtonClass"= |
| =cssclass= | CSS class for the element |- |CSS classes: =foswikiInputField=, =foswikiSubmit= | =cssclass="myButtonClass"= |
| =size= | For =type="text"= or =type="password"=: the width of the input field measured in number of characters. |- |=40= | =size="60"= |
| =maxlength= | For =type="text"= or =type="password"=: the maximum number of input characters. |- |- | =maxlength="12"= |
| =rows= | For =type="textarea"=: the number of rows. |- |- | =rows="5"= |
Expand Down Expand Up @@ -331,7 +329,7 @@ A !FormPlugin form is first processed before it is sent to its action target. Pr
1 Substitution of field references.
1 Validation

<div class="twikiImage"><img src="%ATTACHURLPATH%/form_on_submit_diagram.png" alt="" width='804' height='502' /></div>
<div class="foswikiImage"><img src="%ATTACHURLPATH%/form_on_submit_diagram.png" alt="" width='804' height='502' /></div>

---+++ Substitution of field references
This allows to use entered field values as variables. For example:
Expand All @@ -351,7 +349,7 @@ See [[Sandbox.FormPluginExamples]]


---+++ Upload form
A TWiki upload form to attach a file to a topic should contain these parameters:
An upload form to attach a file to a topic should contain these parameters:
* STARTFORM param =action="upload"=
* STARTFORM param =topic= and =web=, or use the more compact =topic="Web.TopicName"= format
* STARTFORM param =method="POST"=
Expand Down Expand Up @@ -443,35 +441,34 @@ Plugin settings are stored as preferences variables. To reference a plugin setti

---++ 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.
*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 Foswiki is running.

* Download the ZIP file from the Plugin web (see below)
* Unzip ==%TOPIC%.zip== in your twiki installation directory. Content:
* Unzip ==%TOPIC%.zip== in your installation directory. Content:
| *File:* | *Description:* |
| ==data/TWiki/FormPlugin.txt== | Plugin topic |
| ==data/System/FormPlugin.txt== | Plugin topic |
| ==data/Sandbox/FormPluginExamples.txt== | Working examples |
| ==lib/Foswiki/Plugins/FormPlugin.pm== | Plugin Perl module |
| ==lib/Foswiki/Plugins/FormPlugin/Validate.pm== | Plugin Perl module for form validation |
| ==pub/TWiki/FormPlugin/formplugin.css== | Style Sheet |
| ==pub/TWiki/FormPlugin/error.gif== | Error icon |
| ==pub/System/FormPlugin/formplugin.css== | Style Sheet |
| ==pub/System/FormPlugin/error.gif== | Error icon |



---++ Plugin Info

| Plugin Author: | TWiki:Main.ArthurClemens |
| Copyright: | &copy; Arthur Clemens |
| Other authors: | =Validate.pm=, originally =CGI::Validate= by Zenin <zenin@archive.rhps.org> aka Byron Brummer <byron@omix.com>. Copyright (c) 1997,1998 OMIX, Inc. All rights reserved. Use is granted under the same terms of Perl. |
| Plugin Version: | 08 Mar 2007 (V1.2) |
| Plugin Version: | 07 Jan 2009 (V1.3) |
| Change History: | <!-- versions below in reverse order -->&nbsp; |
| 07 Jan 2009 | 1.3 Foswiki release. |
| 08 Mar 2008 | 1.2 Added =condition=, =noformhtml= and =dateformat= attributes. |
| 19 Oct 2007 | 1.1 Added =date= type. |
| 09 Jun 2007 | 1.0.5 Added upload parameter; option to turn off form validation; custom javascript has been replaced by code in =pub/TWiki/JavascriptFiles/foswikiForm.js=; added Flickr example. |
| 09 Jun 2007 | 1.0.5 Added upload parameter; option to turn off form validation; custom javascript has been replaced by code in =pub/System/<nop>JavascriptFiles/foswikiForm.js=; added Flickr example. |
| 27 May 2007 | 1.0.4 Update javascript calls to new =foswikiForm.js=. |
| 19 May 2007 | 1.0.3 Added element attributes: =focus=, =disabled=, =readonly=; Javascript parameters =beforeclick=, =onFocus=, =onBlur=, =onMouseOver=, =onMouseOut=, =onSelect=, =onChange=, =onClick=, =onKeyUp=; form parameter =onSubmit=. Fallback for form POSTs and TWiki versions earlier than 4.2: POST requests are converted to GET requests. |
| 15 May 2007 | 1.0.2 Added form attribute =elementformat=; changed parameter names for consistency: =class= to =cssclass=, =elementformat= to =fieldformat=. |
| 14 May 2007 | 1.0.1 Added missing lib. |
| 13 May 2007 | 1.0 First release. |
| TWiki Dependency: | TWiki 4.2; $TWiki::Plugins::VERSION 1.1 |
| CPAN Dependencies: |- |
| Other Dependencies: |- |
| Perl Version: | 5.005 |
Expand Down

0 comments on commit 2105d03

Please sign in to comment.