[Moin-user] forms for moin

Craig Johnson CPJohnson at edcon.co.za
Tue Sep 19 03:49:19 EDT 2006


 like it, a lot. 
 
I tried something similar, but as a series of macro calls.  Ended up
being a big mess, this looks much cleaner.  I also tried to update the
contents of the Wiki Page from the action, which ran into issues with
the caching mechanism.
 
Why not make the form processor a user written Moin Action, rather than
some arbitrary CGI script?
 
Craig


________________________________

	From: moin-user-bounces at lists.sourceforge.net
[mailto:moin-user-bounces at lists.sourceforge.net] On Behalf Of Matthew
Nuzum
	Sent: 19 September 2006 12:51 AM
	To: Craig Johnson
	Subject: [Moin-user] forms for moin
	
	

	I've started writing a parser for moin that will display forms.
In
	brief, it works like this:
	
	{{{#!form
	... form description here ...
	}}}
	
	Because of this, it can be embedded in a normal wiki page so it
can be
	surrounded with other wiki content. The magic is in the form.py
	parser. It reads the contents of the form section and uses that
to
	generate the HTML for the form fields.
	
	I'm hoping to finish this tomorrow (Sept 19th, I'm GMT -5) by
the end
	of my work day, but I thought I should toss out what I'm doing
here in
	order to get feedback.
	
	First, here is what it won't do: It will *not* process the form.
	instead, either an action needs to be created for the form to be
	processed (which I plan to do, but separately) or you need to
submit
	it to some other cgi/servlet/whatever.
	
	This code is only for displaying the forms.
	
	It works like this, inside the {{{}}} section will be a number
of
	lines. Each line represents one form field. The form fields will
be
	shown in the order they are declared. The available form fields
are:
	 * text (plain text)
	 * e-mail (just like plain text, but with validation code)
	  * url (again)
	 * password - also, the ability to have two password fields that
must
	match each other
	  * text area (multiline plain text) - maybe with the option to
turn
	it into a wysiwyg, possibly using dojo cf:
	http://dojotoolkit.org/docs/rich_text.html
	 * section/separator - a heading for logically grouping form
elements together
	  * select list (option for multi select)
	 * check boxes
	 * radio buttons
	 * hidden field
	
	Each field has in common the following attributes:
	 * required = possible values yes/no/true/false/t/f/0/1
	  * cssclass
	 * id
	 * label
	 * extra information
	 * default value (can be from a cookie, not yet implemented
though)
	 * name (obviously)
	And under consideration
	  * onfocus,onchange,etc - this would be disabled by default,
and
	turned on in wikiconf. If you had a public wiki, untrustworthy
users
	could put mean javascript there. I'm not sure I'm going to use
this,
	but I can see how it would be handy
	  * adding a captcha field type
	
	Here's the syntax. The first line always describes the form.
After
	that, anything goes. Each line is a number of columns, separated
by
	pipes:
	field type | options | name | label | default value | sub items
|
	extra information
	
	Here's an example form:
	{{{#!form
	form|id=TheRealForm;method=get;cancel=f;submit_text=Click
	Me|form1|http://localhost/cgi-bin/submit.cgi
	text|required=t|name|Your Name
	email|required=t|email|Please enter your e-mail address
	subject||subject|Subject|Help Request
	textarea|cssclass=wide|msg|Type your message here
	section|||Optional Information
	select||priority|Priority|3|1=High;3=Medium;5=Low
	}}}
	
	Sorry about the wrapping.
	
	I've implemented code like this before in two different systems,
one
	in PHP, another in XSL.
	
	Each time I implement it, I do it a little better. If you have
any
	feedback, I'd love to hear it.
	
	--
	Matthew Nuzum
	www.bearfruit.org
	newz2000 on freenode
	
	
------------------------------------------------------------------------
-
	Take Surveys. Earn Cash. Influence the Future of IT
	Join SourceForge.net's Techsay panel and you'll get the chance
to share your
	opinions on IT & business topics through brief surveys -- and
earn cash
	
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDE
V
	_______________________________________________
	Moin-user mailing list
	Moin-user at lists.sourceforge.net
	https://lists.sourceforge.net/lists/listinfo/moin-user
	


This message is subject to certain restrictions and qualifications which are contained in our email disclaimer which is available on our website at www.edcon.co.za/Edcon/Disclaimer or from the Group Secretary on (011) 495-6000.
 
The disclaimer also provides our corporate information and names of our directors as required by law.
The disclaimer is deemed to form part of this message in terms of Section 11 of the Electronic Communications and Transactions Act, 2002.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/moin-user/attachments/20060919/046e0a86/attachment.html>


More information about the Moin-user mailing list