
Hello, below is my proposal for a Nevow-newbie FAQ. The only problem is, someone has to answer them, but I belive you can do that ;) 1. How could I change the way the form is displayed? Edit freeform.py? Are there any other alternatives? Eg. I'd like to have each form enclosed in <table>, each field is a row in form of <tr><td align=right>label: </td><td> field </td></tr> 2. What good is formless.Group for? 3. How can I have a bunch of text fields in a one field? For example, I'd like to create a date entry field - 4 digits in one field, and 2 digits per next 2 fields, and I'd like it to display in one line, separated by dashes. Could I somehow group a few formless.Integer fields in one line and separate them by dashes, or should I create a totally new field type (just like the fields in freeform.py are reated) ? 4. What does formless.Table do? -- Michal Pasternak :: http://pasternak.w.lub.pl :: http://winsrc.sf.net For your Occupation, choose 2 of the following three: 1) Fun, 2) Well-paying, 3) Legal.

On Mar 29, 2004, at 10:20 PM, Michal Pasternak wrote:
Hello,
below is my proposal for a Nevow-newbie FAQ.
The only problem is, someone has to answer them, but I belive you can do that ;)
1. How could I change the way the form is displayed? Edit freeform.py? Are there any other alternatives?
Eg. I'd like to have each form enclosed in <table>, each field is a row in form of <tr><td align=right>label: </td><td> field </td></tr>
The original goal was to have the default renderers use patterns and slots so the template can provide a skin. The implementation hard coded the skin right into the renderers for expediency, and to make the code as easy as possible for others to understand. Since freeform is already difficult to understand, I have been reluctant to add this extra level of indirection. Another approach is to write your own adapters and register them instead of the freeform adapters for rendering.
2. What good is formless.Group for?
It groups multiple forms (bindings) into a single form... you won't ever really use it directly. You might find it useful if you want to call multiple methods as a result of one form posting, but only want to do so if all method argument validation passes.
3. How can I have a bunch of text fields in a one field? For example, I'd like to create a date entry field - 4 digits in one field, and 2 digits per next 2 fields, and I'd like it to display in one line, separated by dashes.
Could I somehow group a few formless.Integer fields in one line and separate them by dashes, or should I create a totally new field type (just like the fields in freeform.py are reated) ?
You should write a new Typed, such as Date, and then write a new ITypedRenderer adapter which renders the field however you like. You can subclass BaseInputRenderer and just override input to return just the fields, and not the label or description.
4. What does formless.Table do?
Nothing. It should be removed. dp
participants (2)
-
Donovan Preston
-
Michal Pasternak