# HG changeset patch # User Paul Boddie # Date 1355269606 -3600 # Node ID fdf3f273e417d0df62badfeeedf0f2105fa016e8 # Parent bec2e385d5047b095106173e2efd4364cf298bbc Added a draft of the help page. diff -r bec2e385d504 -r fdf3f273e417 pages/HelpOnMoinForms --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pages/HelpOnMoinForms Wed Dec 12 00:46:46 2012 +0100 @@ -0,0 +1,288 @@ +##master-page:HelpTemplate +##master-date:Unknown-Date +#format wiki +#language en + +== MoinForms == + +The !MoinForms support for !MoinMoin provides a way of describing Web forms that can be embedded in Wiki pages and handled by special Wiki actions. + +<> + +== Creating Forms == + +To embed a form within a page, a special region must be declared as in the following example: + +{{{{ +{{{#!form fragment=exampleform + +|| '''Name''' || <> || +|| '''Address''' || <> || +|| '''Country''' || <> || +|| || <> || + +}}} +}}}} + +This example demonstrates... + + * A region providing a form + * Within which form fields can be inserted using the `FormField` macro + * Using normal Wiki syntax, meaning that normal formatting facilities can be used to present forms (with a table being used in this case) + +Here, four form fields are used, but their definitions are not provided in the form region itself. Instead, each of the fields references a !WikiDict providing such definition details, and this is described [[#Defining_Fields|below]]. + +The above form definition produces the following form: + +{{{#!form fragment=exampleform + +|| '''Name''' || <> || +|| '''Address''' || <> || +|| '''Country''' || <> || +|| || <> || + +}}} + +=== Defining Form Regions === + +{{{{ +{{{#!form fragment= action= +... +}}} +}}}} + +Form regions must be defined using the special `#!form` notation and should provide a `fragment` identifier that uniquely identifies the form on the page, along with an `action` identifier indicating which action should be used to interpret and process the form data. If the `action` argument is missing, the default `MoinFormHandlerAction` is used. + +Normal Wiki markup can be used within form regions, but care must be taken to ensure that where other regions are embedded within form regions, the number of brackets used to declare the outer regions is greater than the number used to declare the embedded regions. This technique is described on the HelpOnParsers page, but is also illustrated below. + +{{{{{ +{{{{#!form fragment=exampleform action=ExampleAction + +Fill out the form below: + +{{{#!wiki important +Be sure to fill out '''everything'''! +}}} + +Name: <> +Address: <> +Done? <> +}}}} +}}}}} + +Note how the form declaration uses `{{{{` and `}}}}` while the [[HelpOnAdmonitions|adminition]] uses `{{{` and `}}}`. + +=== Using the Form Field Macro === + +{{{ +<,,