[Zope] creating a generic field gadget

R. David Murray bitz@bitdance.com
Tue, 23 May 2000 21:07:38 -0400 (EDT)


On Wed, 24 May 2000, Graham Chiu wrote:
> >But I now want this dtml-document when rendered to read the values of
> >fieldname, and fieldname-error, and then generate the dtml equivalent to
> >this ...
> >
> ><dtml-if userid>
> > value="<dtml-var userid>"
> ></dtml-if>> <br>
> ><dtml-if userid-error>
> > <font size="2" color="red"><dtml-var userid-error></font><br>
> ></dtml-if>

Here's a clue <grin>:

<dtml-if "_.has_key(fieldname)">
  value="<dtml-var "_[fieldname]">"
<dtml-else>

This checks for the existence of the contents of fieldname as
a valid name in the name space, which may or may not be what
you are looking for, but at least it is a clue.  Other clues
might be 'this()' and 'hasattr()'.

--RDM