[Zope] dtml-if and checkboxes
Jim Penny
jpenny@universal-fasteners.com
Fri, 4 Oct 2002 17:10:07 -0400
On Fri, Oct 04, 2002 at 04:51:14PM -0400, Hires, Russell (CAP, CARD) wrote:
I emailled Rusell in a private email, but it may do some good to put it
on the mailing list where others who have not travelled far in the way
can see this:
> Well, I got one better:
> <dtml-if check_box>
> The check box is checked!
> </dtml-if>
Be very careful with this form. If at some later date, you are working
and change it to this:
<dtml-if "check_box">
The check box is checked!
</dtml-if>
then your program will stop working again. Moreover, since the "simple
form" above will try acquisition if check_box is not found in the
REQUEST, you may have a very hard time debugging boxes that are
unexepectedly checked.
That is why the more explicit
<dtml-if "REQUEST.has_key('check_box')">
The check box is checked!
</dtml-if>
is much preferable, even though it is a bit more typing.
Same with zpt forms given. They are, by design, explicit.
Jim Penny
>
> 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
>