[Twisted-web] Formless, custom form layout

Richard Wall m-lists at the-moon.net
Thu Jun 16 17:56:29 MDT 2005

Phil Mayers wrote:
> Richard Wall wrote:
>> I am trying to customise my Formless layout based on
>> examples/customform.py, but I'm not sure how I can group inputs in
>> fieldsets.
> Good question. I asked the same one a while back (no reply - maybe the
> mail didn't get through). I mused:

It did, but I didn't spot it until after I'd posted my message. I've
learned alot since.

> I suspect I can subclass annotate.Typed or use the complexType stuff to
> somehow group a textbox and dropdown together into one logical bit of
> HTML that is rendered as a single "control"
> ...but other commitments have kept me from revisiting this

For custom output look at custom renderers. You have to register them as
adaptors using compy.registerAdaptor.

Read this article if adaptors are new to you (they were to me)...

Incase your wondering where Nevow registers it's default adaptors (I
did) they're in nevow/__init__.py.

Some examples...

A multiple choice element (missing from Nevow)...
...I'd like to see this (or something similar) included as default. It's
a very common form pattern.

A date parser element. User can enter date into text box however they

A fix for the output of radio lists...

>> eg. http://rafb.net/paste/results/dhZOhk37.html
> I get a 404

I think they expire after a while. Have used another pastebin here.

>> That's my ideal layout, can anyone give me hints on howto achieve it?
> Let me know if you find out!

I found out on #twisted.web from fog, STemplar and others.

First checkout examples/customform.py from Nevow svn but it doesn't
demonstrate argument slots (as opposed to argument patterns)

Here's an example of argument slots and patterns...

So you do get control over each arguments layout and position. The
default Nevow argument pattern doesn't validate (div inside span!).
Using dl,dt,dd makes more sense.

You might also want to apply this patch to nevow...

Hope this saves you some time.


More information about the Twisted-web mailing list