- Testing for query variable existance in dhtml
I have a document that is called with or without a query value. http://myhost/mydocument?list=thislist or http://myhost/mydocument What's the best way to determine if list is defined in the request? I tried <!--#if REQUEST.has_key(list)--> That didn't work, either with or without quotes Also, whats the correct way to determine if list points to a valid object, I tried this. <!--#with REQUEST--> <!--#if _.has_key(list)--> <!--#var _.getitem(list,1)--> This seems to work if list is pointing to a valid object, but I get "Sorry, Zope is offline" error if list is an invalid object name. What I really want to know is if list names something IN the current Folder that contains the current document.. Any suggestions? Could I use <!--#if _.has_key(PARENT[0].[list])--> ?? Thanks Brad Clements, bkc@murkworks.com (315)268-1000 http://www.murkworks.com (315)268-9812 Fax netmeeting: ils://ils.murkworks.com ICQ: 14856937 We must come down from our heights, and leave our straight paths, for the byways and low places of life, if we would learn truths by strong contrasts; and in hovels, in forecastles, and among our own outcasts in foreign lands, see what has been wrought upon our fellow-creatures by accident, hardship, or vice. - Richard Henry Dana, Jr. 1836
Brad Clements wrote:
I have a document that is called with or without a query value.
http://myhost/mydocument?list=thislist
or
What's the best way to determine if list is defined in the request? I tried
<!--#if REQUEST.has_key(list)-->
That didn't work, either with or without quotes
Did you you try: <!--#if "REQUEST.has_key('list')"--> In all of the examples you've given, you've ommitted quotes for 'list'. If you use list in an expression without quotes, you are trying to get the value of list. In most of your examples, you *really* want the string (ie name) list.
Also, whats the correct way to determine if list points to a valid object, I tried this.
<!--#with REQUEST--> <!--#if _.has_key(list)--> <!--#var _.getitem(list,1)-->
You are missing a lot of quotes.
This seems to work if list is pointing to a valid object, but I get "Sorry, Zope is offline" error if list is an invalid object name.
I'm not sure what you mean by valid. If you want to test if the name has a definition, then just use: <!--#if list-->
What I really want to know is if list names something IN the current Folder that contains the current document..
Any suggestions?
<!--#if list--><!--#unless "REQUEST.has_key('list')"--> ... <!--#/unless--><!--#/if--> Jim -- Jim Fulton mailto:jim@digicool.com Technical Director (540) 371-6909 Python Powered! Digital Creations http://www.digicool.com http://www.python.org Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats.
participants (2)
-
Brad Clements -
Jim Fulton