WorldWander logo
Main

The Road Behind

Venezuela
Trinidad
Curacao
Galapagos
Ecuador
Peru
Bolivia
Paraguay
Argentina
Chile
Hong Kong
Thailand North
Thailand South
Malaysia
Cambodia
Singapore
Nepal
Kathmandu
Royal Trek
Nepal Trek
India
India Palace
Udaipur
Bangalore
Greece
Islands
Rhodes
Camping
Olympia
Turkey
Istanbul
Bath
Bursa
Cappadocia
Bodrum
South Africa
Garden Route
Cape Town
Namibia
Fish River
Etosha
Botswana
Zimbabwe
Wedding
Great Ruins
Germany
Bathroom
Netherlands
Spain
Madrid
Seville
Granada
Gibraltar
Morocco
Portugal
Sintra
France
Normandy
Egypt
Pyramids
Nile
Aswan
Abusimbel
Luxor
Valley of Kings
Alexandria
Red Sea
Jordan
Kings Valley
Aman
Palestine

The Road Ahead

Isreal
Czech Republic
Austria
Italy
Switzerland
England
Find pages
Unused pages
Undefined pages
Page Index

Set your name in
UserPreferences


Referenced by
WikiForms




JSPWiki v2.2.33


WikiFormsExampleText


WikiForms Form Plugin Example

This page uses the WikiForms plugins to provide parameters to the CurrentTimePlugin, and displays the result.

Giving Defaults

The first item, hidden in normal WikiPage viewing, looks like this:

[{FormSet form='testform' format='EEE, d MMM yyyy HH:mm:ss Z' rd1='r2'}]

The FormSet plugin sets the default date format for a form field format in form testform. (It also sets a radio button default value - just for demonstration, no real functionality.)

Form Output and Error Messages

The second item, also hidden, looks like this:

[{FormOutput form='testform' handler='CurrentTimePlugin' populate='handler'}]

It specifies that the CurrentTimePlugin, which comes in the stock JSPWiki distribution, should be used to generate some output to display here. While the output is usually built in response to a POST from a form called testform, the populate attribute here hints the plugin that we want default information even if no post has been made. This is what the output looks like:

Mon, 21 May 2012 13:15:34 -0400

Opening the Form

The third element starts the actual HTML form called testform:

[{FormOpen form='testform'}]

Form Fields

We'll use a text field to provide the format of CurrentTimePlugin's output. Notice that the name of this field is format - the name of CurrentTimePlugin's relevant parameter. This value is passed straight to CurrentTimePlugin on submit:

Enter the time format string: [{FormInput type='text' name='format'}]
Enter the time format string:

The rest of the form merely demonstrates some other HTML form elements. The don't work with CurrentTimePlugin, but you'll probably want them in your special form handler plugins.

Select list:

[{FormSelect name='sel1' value='fee;*fie;foe;foo'}]\\

(Notice, here, the asterisk; this denotes the default value to select. The separator character and the default character can be overridden - check FormSelect for more information.)


Textarea:

[{FormTextarea name='area1' value='Write your own text here' rows=8 cols=40}]

Submitting

Before finishing up, we need to add a submit button:
[{FormInput type='submit' name='x' value='Update'}]

Closing the Form

And, finally, an invisible closing element to denote that this form has ended:
[{FormClose}]


Go ahead, click on Update, and notice how your format changes and selections are retained.


Synopsis:

  • (Optional) Start with the FormSet, give defaults
  • (Optional) If the form is supposed to give out information, add an output
  • (Mandatory) open the form
  • (Optional) add any text/select elements
  • (Mandatory) add a submit
  • (Mandatory) close the form



Go to top  
This page last changed on 24-Apr-2005 12:02:04 EDT by unknown.
Please make one.