[Zope] dtml-if and checkboxes

Hires, Russell (CAP, CARD) Russell.Hires@gecapital.com
Fri, 4 Oct 2002 16:51:14 -0400


Well, I got one better:
><dtml-if check_box>
The check box is checked!
</dtml-if>

This works because if it's checked, then it's there. If it isn't checked, it
isn't there, and it fails. So no output. 

Thanks for pushing me in the right direction. 

Russell

-----Original Message-----
From: Meilicke, Scott [mailto:scott.meilicke@intp.com]
Sent: Friday, October 04, 2002 4:30 PM
To: Hires, Russell (CAP, CARD); 'zope@zope.org'
Subject: RE: [Zope] dtml-if and checkboxes


<dtml-if check_box> 
<dtml-if expr="check_box == ('on')"> 
The check box is checked! 
</dtml-if> 
</dtml-if> 
The above should work, but there may be a better way... Maybe something like
<dtml-if "check_box and check_box == ('on')">, not sure though.
Scott 
-----Original Message----- 
From: Hires, Russell (CAP, CARD) [mailto:Russell.Hires@gecapital.com] 
Sent: Friday, October 04, 2002 1:15 PM 
To: 'zope@zope.org' 
Subject: [Zope] dtml-if and checkboxes 


Hey All, 
I'm experimenting with zope again, playing with the REQUEST object and form 
objects. In my latest delimma, I've got the following snippet: 
<dtml-if expr="check_box == ('on')"> 
The check box is checked! 
</dtml-if> 
What I don't get: if the checkbox is checked in the form, then this works, 
and I get the output. If it isn't checked, then I get an error saying that 
the checkbox ("check_box" in the form) isn't defined. This is borne out as 
well by <dtml-var expr="REQUEST.form">, which shows a text box's name and 
the value that it holds (whether it holds a value or not), and the 
checkbox's name and value ('on'), when it's checked. If it isn't checked, it

isn't there at all. So, I guess I'm going to have to look to see whether 
it's there or not, right? How would I do that? 
Thanks for the help! 
Russell 
_______________________________________________ 
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 ) 
The information contained in this email message may be privileged and is
confidential information intended only for the use of the recipient or any
employee or agent responsible for delivering it to the intended recipient.
Any unauthorized use, distribution or copying of this information is
strictly prohibited and may be unlawful.  If you have received this
communication in error, please notify the sender immediately and destroy the
original message and all attachments from your electronic files.