[ZPT] (no subject)
Evan Simpson
evan@digicool.com
Thu, 28 Jun 2001 19:25:03 -0500
From: "Magnus Heino" <magnus.heino@rivermen.se>
> I am using the Forumlator product to handle forms. A form is a
> Folderish object that contains all form elements, like text fields,
> integer fields, password fields etc. You can setup validation on
> fields etc, so it's really nice.
Ah, metaprogramming. If I were doing this, I would write a Script that
rendered the Formulator template and copied the result into another
template. This other template would be the macro source for the page
that uses the form. Broken down:
1. Template "MyPage" contains (among other stuff):
<div metal:use-macro="here/form_template/macros/form"></div>
2. Template "form_template" is written by Script "FormLever", by doing:
container.form_template.write(container.formulated())
3. Template "formulated" looks like:
<form tal:attributes="metal:define-macro string:form">
<table>
<tr tal:repeat="element here/form/get_all_elements">
<td tal:content="element/render" />
</tr>
</table>
</form>
When you change the Formulator form, you pull the FormLever.
Cheers,
Evan @ digicool