[Zope] dtml-if and checkboxes
Passin, Tom
tpassin@mitretek.org
Fri, 4 Oct 2002 17:23:28 -0400
[Charlie Reiman]
> Actually, this will work although it is wordy. <dtml-if=20
> somevar> is special and will evaluate to false if somevar is=20
> not defined.=20
Ah, I did not know that. Nice. Javascript is like that - undefined
variables return "undefined" which (along with null, 0, and "")
evaluates to false for logical tests, so using Javascript's
short-circuit logical evaluation, you can do things like
if (theVar && theVar.property){
// the variable and its property both exist
}
>This is very different from <dtml-if "somevar">=20
> which will throw and exception if somevar is not defined.
>
Right.=20
> Having said that, using has_key is a lot cleaner.
>=20
Cheers,
Tom P=20