Trying to figure out a way to compare a user's cookie (zwiki_theme) with the options in a form list and if the cookie value and option value match, that option will be 'selected'. Here's the code I've played around with in which nothing is returned. Any help would be appreciated. <h2>Available Themes</h2> <dtml-let usertheme="REQUEST.get('zwiki_theme')"> <select name="zwiki_theme"> <dtml-in expr="themes.objectValues('File')" sort=title> <option value="&dtml-absolute_url;" <dtml-if "absolute_url == usertheme">selected</dtml-if>> <dtml-var title> </option> </dtml-in> </select> </dtml-let>
On 19.Mai 2003 - 13:08:45, Jordan Carswell wrote:
Trying to figure out a way to compare a user's cookie (zwiki_theme) with the options in a form list and if the cookie value and option value match, that option will be 'selected'. Here's the code I've played around with in which nothing is returned. Any help would be appreciated.
<h2>Available Themes</h2> <dtml-let usertheme="REQUEST.get('zwiki_theme')"> <select name="zwiki_theme"> <dtml-in expr="themes.objectValues('File')" sort=title>
<option value="&dtml-absolute_url;" <dtml-if "absolute_url == usertheme">selected</dtml-if>>
I would change that to: <dtml-if "absolute_url == usertheme"> <option value="&dtml-absolute_url;" selected> <dtml-else <option value="&dtml-absolute_url;"> </dtml-if Andreas -- Your mode of life will be changed for the better because of good news soon.
On Mon, May 19, 2003 at 10:57:34PM +0200, Andreas Pakulat wrote:
I would change that to: <dtml-if "absolute_url == usertheme">
still a problem there... unless you've assigned something to this name, absolute_url is a method. the expression in quotes is a python expression, in which methods are not automagically invoked. so the above test will never be true. maybe this is what's intended? <dtml-if "absolute_url() == usertheme"> -- Paul Winkler home: http://www.slinkp.com "Muppet Labs, where the future is made - today!"
On 19.Mai 2003 - 13:43:25, Paul Winkler wrote:
On Mon, May 19, 2003 at 10:57:34PM +0200, Andreas Pakulat wrote:
I would change that to: <dtml-if "absolute_url == usertheme">
still a problem there... unless you've assigned something to this name, absolute_url is a method. the expression in quotes is a python expression, in which methods are not automagically invoked. so the above test will never be true.
maybe this is what's intended?
<dtml-if "absolute_url() == usertheme">
Yes, I forgot the parentheses. Andreas -- You dialed 5483.
participants (3)
-
Andreas Pakulat -
Jordan Carswell -
Paul Winkler