[Zope] newbie cuestion
Thomas B. Passin
tpassin@mitretek.org
Fri, 22 Jun 2001 16:15:46 -0400
Use <dtml-sequence-item> to access each item in a list when you are
interating through it using <dtml-in>. Conversely, <dtml-in> must be given
a list to work with.
To be certain of what your form is returning to Zope, look at the contents
of the REQUEST by simple adding this to a plain page:
<dtml-var "REQUEST.form">
You will see all the form variables. Braces {like this} are dictionaries
(or hashes, if you prefer), brackets [like this] are lists.
This will give you a list of all the name/value pairs in the form:
<dtml-var "REQUEST.form.items()">
This will give you a list of all the field names in the form:
<dtml-var "REQUEST.form.keys()">
If you have a key (that is, a field name in the form) of 'k1', you could
get its value with
<dtml-var "REQUEST.form['k1']>
It's a little trickier if you are interating through the keys as in
<dtml-in "REQUEST.form.keys">
<dtml-var "REQUEST.form[_['sequence-item']]">
</dtml-in>
You have to do this little hack because you can't use a name like
sequence-item inside double quotes (because python would try to subtract
item from sequence). _['...'] is an alternate way to access a variable
whose name is known to the current namespace.
Finally, if you have more than one checkbox with the same name, for that
field name you will get a list of all the values for all the boxes with that
name.
This should give you enough to figure out how to proceed. Just make sure to
look at the form data first before doing any more coding.
Cheers,
Tom P
[Orlando Sanchez]
so the question is : how can I reference the values of my checboxes in the
result method ?
if i write
<dtml-in rowsnamesmethod>
<dtml-var rowname>
</dtml-in>
it gives me the row names, but I need the values of a checbox named that
way, i try
<dtml-in rowsnamesmethod>
<dtml-var <dtml-var <rowname>>
</dtml-in>