[Home]FormsInWiki

MeatballWiki | RecentChanges | Random Page | Indices | Categories

It would be nice for a community to be able to create wiki pages with form fields, i.e. checkboxes, etc.

Sure, this can be done now with HTML, but since raw HTML is too unsafe for many, it would be nice to have a sanitized version. And a GUI for building the forms in the page edit box.

See, for example, http://scott.andstuff.org/Preferences. The macro currently only implements buttons, text fields, hidden elements, and images, but it would be trivial to extend to additional fields.

One of TWiki's more interesting features is [TWikiForms], which seems useful for those who need such features.

thanks for pointing me to implementations


ChuckAdams: The following is from a draft document on wiki form syntax. Although forms on a public wiki may not be entirely useful, since users generally can't write handlers for them, there's the possibility of mailto: actions, handlers being added later by the admin, and perhaps internal wiki code using this syntax instead of raw HTML.

{{FORM myform action=myhandler

The text of a form is bracketed with {{FORM ... FORM}}

A line containing a form element starts with @elemname (which populates name and id actually) then a colon.  
The attributes of the element may optionally follow, using @elemnane(attribs).  
If an element needs to be repeated over several lines, it may be continued with a solitary @ (no colon)

@myline(50): Four or more underscores means an input line.  ____
(More underscores means longer by some relative amount, tho explicit size overrides it)

Square brackets suggest checkboxes.  
The text in the checkboxes is the value (they will default to id_x where id is the element's id, and x increases from 0). 
A starting * makes it checked.  Omitting any text between options will automatically copy the checkbox's name to the label 
(use a   or some non whitespace like an empty element to force it to be blank).  
Doubled square brackets still link as normal.  
Single-square bracket may be DWIM'd, but no guarantees (so don't put it on an @ line if you can help it, 
or for SquareTags, ensure your end tag is on the same line, e.g. for [b]foo[/b])

@flavorchoice: [grape] [*lemon] [raspberry]

@own: [pc] Intel/AMD Computer [i]not a mac[/i] [mac] Apple [vcr] VCR [dvd] DVD player [tivo] TiVo

Similarly, parenthesis suggest radio buttons.  If you need actual parenthesis, use <nowiki> tags.  
Note that while the continuing @ won't be rendered, you'll still need to put in linebreaks.  
If you need list items or indents or whatever, just put the first-column char right after the @ sign, e.g. @* 
(all the form parser does is scan forward for lines containing @ with nothing following).
As with checkboxes, leaving out names causes them to be sequentially numbered.

@age_demo: (*) Under 18 <br>
@          ( ) 18 to 35 <nowiki>(the marketing demo of choice)<br>
@          ( ) 30-50<br>
@          ( ) 50 and up<br>


Dropdowns and listboxes are both accomplished with [^value|label] syntax.  
If the bar is omitted, the value and label are identical.
optgroups are not yet implemented

@state:  [^*xx|Choose a state]
@        [^AL|Alabama]
@        [^AK|Alaska]
@        [^AZ|Arizona]
@        [^AR|Arkansas]


@skills(5,multi): [^C] [cpp|C++] [Ada] [COBOL] [Java]

The submit button is simply a link, as is reset.  
The text is optional, as is the value.  
More than one such link on a line results in undefined behavior. 

@submit_a: [[submit:via_a|Submit Button A]] 
@submit_b: [[submit:via_b|Alternate Submit Button B]] 

@reset: [[reset:]] (note the trailing colon.  forgetting it in a {{FORM..FORM}} will DWIM, however)

Hidden values are also links.  Putting more than one on a line is undefined behavior.

@magicstuff: [[hidden:put whatever you like here]]

Still TODO: textarea, password, image, file

FORM}}
</nowiki>


http://jot.com seemst to be a wiki like software implementing this idea. --ThomasKalka


See also WikiContextuality, SparrowWeb.

CategoryUncommonWikiTechnology CategoryWikiTechnology


Discussion

MeatballWiki | RecentChanges | Random Page | Indices | Categories
Edit text of this page | View other revisions
Search: