RE: [Zope] dtml-if and checkboxes
4 Oct
2002
4 Oct
'02
9:23 p.m.
[Charlie Reiman]
Actually, this will work although it is wordy. <dtml-if somevar> is special and will evaluate to false if somevar is not defined.
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"> which will throw and exception if somevar is not defined.
Right.
Having said that, using has_key is a lot cleaner.
Cheers, Tom P
8585
Age (days ago)
8585
Last active (days ago)
0 comments
1 participants
participants (1)
-
Passin, Tom