[ZPT] conversion in ZPT.
Charlie Clark
charlie at begeistert.org
Mon Jul 21 16:03:25 EDT 2003
On 2003-07-21 at 10:09:56 [+0200], Exteam wrote:
>
> hi folks,
>
> can u please help us in the conversion of a DTML example to ZPT.
>
> we are trying to get a value from a list and make it as default for a
> specified field in a formulator.
>
> The DTML example is given
>
> http://fool.freezope.org/zope/howtos/formulator_fields/test_formulator_html
>
> Please help us in this
Hello Prashad,
I've never worked with Formulator so you're on your own there. I'm also
successfully forgetting DTML so I can just look the HTML.
<form enctype="enctype" method="POST" name="formulator" action=""
tal:define="
genders python: ["Male", "Female", "No response"];
selected python: "Male">
<table>
<tr>
<td>Your Gender</td>
<td>
<input name="field_gender" type="radio" tal:repeat="gender genders"
tal:content="gentle" tal:attributes="checked python:test(gender ==
selected, 1, 0)"/>
</td>
</tr>
</table>
</form>
You might have to put the tal:repeat in a <span></span> outside of the
<input> if this doesn't work staight off but this is in general how you do
it. It's a bit annoying that checked gets set to "checked", ie. it would be
nice to set be able to set empty attibutes just using tal:condition.
Charlie
More information about the ZPT
mailing list