Help with a DTML expression/comparison
Hey to everyone, I'm shooting myself in the foot here with this construct: <select name="begin_day" size="1"> <dtml-in "_.range(1,32,1)"> <option value="&dtml-sequence-item;" <dtml-if expr="begin_day == _.getitem('sequence- item')"> selected </dtml-if> >&dtml-sequence-item;</option> </dtml-in> </select> Inserting with dtml-var any of begin_day or sequence- item yields at some point the same result, logically. I'm trying to make the form field default to a formerly specified value. BUT, the comparison between the two, won't work. Even comparing two _.getitems doesn't work. So it's expected that at no point does the selected property appear in my html source. Please help. I'm shooting myself in the foot here. Thanks in advance, Manuel ---------------------------------------------------------- Universidad Federico Santa Maria - Campus Guayaquil
Manuel, You'll probably find that your comparing a string 'begin_day' to an integer 'sequence-item'. Try something like: <dtml-if expr="_.int(begin_day) == _.int(_.getitem('sequence-item'))"> hth Phil ----- Original Message ----- From: "Manuel Amador (Rudd-O) Gerente de desarrollo Alpha Omega Creative Solutions http: //www.alomega.com/" <amadorm@usm.edu.ec> To: <zope@zope.org> Sent: Tuesday, October 10, 2000 9:56 PM Subject: [Zope] Help with a DTML expression/comparison
Hey to everyone,
I'm shooting myself in the foot here with this construct:
<select name="begin_day" size="1"> <dtml-in "_.range(1,32,1)"> <option value="&dtml-sequence-item;"
<dtml-if expr="begin_day == _.getitem('sequence- item')"> selected </dtml-if> >&dtml-sequence-item;</option>
</dtml-in> </select>
Inserting with dtml-var any of begin_day or sequence- item yields at some point the same result, logically. I'm trying to make the form field default to a formerly specified value.
BUT, the comparison between the two, won't work. Even comparing two _.getitems doesn't work. So it's expected that at no point does the selected property appear in my html source.
Please help. I'm shooting myself in the foot here.
Thanks in advance,
Manuel
---------------------------------------------------------- Universidad Federico Santa Maria - Campus Guayaquil
_______________________________________________ Zope maillist - Zope@zope.org 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 )
"Manuel Amador (Rudd-O) Gerente de desarrollo Alpha Omega Creative Solutions http://www.alomega.com/" wrote:
BUT, the comparison between the two, won't work. Even comparing two _.getitems doesn't work. So it's expected that at no point does the selected property appear in my html source.
Please help. I'm shooting myself in the foot here.
------------------------------------------------ <tr> <td>Honorific:</td> <td> <SELECT name="honorific"> <dtml-in valid_honors> <dtml-if "honorific==_['sequence-item']"> <OPTION "<dtml-var sequence-item>" SELECTED><dtml-var sequence-item></OPTION> <dtml-else> <OPTION "<dtml-var sequence-item>"><dtml-var sequence-item></OPTION> </dtml-if> </dtml-in> </SELECT> -------------------------------------------------------- This works for me where valid_honors is a list of honorifics (['Mr.', 'Ms.','Dr.', ...]) HTH, -- Tim Cook -- Cook Information Systems | Office: (901) 884-4126 8am-5pm CDT * It's easy to stop making mistakes. Just stop having ideas. * FreePM Project Coordinator http://www.freepm.org OSHCA Founding Supporter http://www.oshca.org
participants (3)
-
//www.alomega.com/ -
Phil Harris -
Tim Cook