Ok,
dtml-let nameAsAString="'index_html'"
dtml-var "_[nameAsAString]"
/dtml-let
works alright, even my longer (using a TinyTablePlus)
dtml-in Items sort=Position
dtml-let Prefix="'FormElement_'"
thePos=Position
nameAsAString="Prefix+thePos"
dtml-var nameAsAStringbr
dtml-var "_['FormElement_1']"br
/dtml-let
/dtml-in
will work(as expected), BUT:
dtml-in Items sort=Position
dtml-let Prefix="'FormElement_'"
thePos=Position
nameAsAString="Prefix+thePos"
dtml-var nameAsAStringbr
dtml-var "_['FormElement_1']"br
dtml-var "_[nameAsAString]"br
/dtml-let
/dtml-in
definitely won't, Key Error:
File /.../lib/python/DocumentTemplate/DT_In.py, line 691, in renderwob
(Object: Items)
File /.../lib/python/DocumentTemplate/DT_Let.py, line 147, in render
(Object: Prefix=quot;'Service_'quot;
thePos=Position
nameAsAString=quot;Prefix+thePosquot;)
File /.../lib/python/DocumentTemplate/DT_Util.py, line 337, in eval
(Object: _[nameAsAString])
(Info: nameAsAString)
File lt;stringgt;, line 0, in ?
File /.../lib/python/DocumentTemplate/DT_Util.py, line 163, in
careful_getitem
KeyError: (see above)
The string's content seems okay to me, so why can't I look up the object?
The namespace should be okay since I can call the request variables
_directly_.
What's wrong?
tia,
Danny
-Ursprüngliche Nachricht-
Von: Steve Drees [mailto:[EMAIL PROTECTED]]
Gesendet: Mittwoch, 25. Oktober 2000 21:08
An: [EMAIL PROTECTED]
Betreff: RE: [Zope] Calling form elements by name
dtml-let "nameAsAString = 'index_html'"
dtml-var "_[nameAsAString]"
/dtml-let
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Danny
William Adair
Sent: Wednesday, October 25, 2000 1:27 PM
To: [EMAIL PROTECTED]
Subject: [Zope] Calling form elements by name
How can I render a REQUEST variable in DTML if I have its id as a string?
I would like to construct its name as a string and then call the REQUEST
variable by its name.
(Meaning I will have to make sure such an object exists)
tia,
CU+Prost,
Danny
___
Zope maillist - [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://lists.zope.org/mailman/listinfo/zope-announce
http://lists.zope.org/mailman/listinfo/zope-dev )
___
Zope maillist - [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://lists.zope.org/mailman/listinfo/zope-announce
http://lists.zope.org/mailman/listinfo/zope-dev )