Form Plugin Examples

See System.FormPlugin

Please view the raw text of this topic to learn how these forms are created.

Form elements

Format

* Your name:
* Favorite team member:

Multi-select items

Nice persons with custom titleformat:
*
Not-so-nice persons with selected defaults:
*
Multiselect is selectmulti:

Disabled

Your name:
Choose a name:

Read-only

Your name:
Enter text:

Password

Enter a password:
*

Date

Publishing date

Getting form feedback

Retrieving values with URLPARAM

Your name:
*
Choose friends:
*

Submit form to view values:
  • Name =
  • Friends =

Formatting forms

Hints and mandatory indicators

Your name:
*
Enter something else:
*

Format: example of items on one line

For example setting param elementformat=" $t $e $m $h ":

Your name:

Adding CSS styles

Setting:
formcssclass="foswikiFormSteps"
elementcssclass="foswikiFormStep"

Your name:

Custom CSS classes

Your name:

Javascript enhancements

Focus

This example is disabled by default, because new browsers automatically scroll the page to the input field with focus.

Show Focus example

Original source:
%STARTFORM{
   name="focusform"
   action="view"
}%%FORMELEMENT{
   name="Name"
   type="text"
   focus="on"
   title="Your name:"
}%%ENDFORM%

Placeholder text

Click on the field...

onMouseOver, onMouseOut

Mouse over the field...

onSelect, onBlur

Doubleclick on the text to select it...

onKeyUp

Change the text...

(in fact, onChange can be used as well, but that tends to react slower)

Change output will be written here...

onClick

Click a checkbox...

onSubmit

Give a warning before submitting the form...

Validation

If the form is filled in correctly you will be redirected to FormPluginExamplesFeedback.

Your name:
*
Team goal:
*
Team members:
*

Substitution of field references

Reference field values as variables. In hidden field 'CarbonCopy' we are creating a combined entry of Name and Password fields:
%FORMELEMENT{
name="CarbonCopy"
type="hidden"
default="$Name earns $Salary"
}%

Your name:
*
Your salary:
*

Real world examples

Create a new AUTOINC page

Save topic text to another topic

Topic text:

Save field value to another topic

Title:

Upload

Attach new file
Comment

Working with other extensions

SendEmailPlugin form

E-mail form for SendEmailPlugin - form works if the plugin is installed and enabled.

%SENDEMAIL%

To:
*
Subject:
Message:

Accessing other sites: Flickr

This form lets you search for Flickr photos that have been tagged with a name.

Note: for this example to work, add http://www.flickr.com/ to {PermittedRedirectHostUrls} in configure.

Search name on Flickr: