how does dtml-if evaluate REQUEST variables?
Hello, when I try to evalute a REQUEST variable I get the following behaviour: <dtml-if entryid> evalutes true when http://server/dtml.doc?entryid=0 is called. I thought 0 would evaluate to false. How can I tell dtml to evalute to false? Thanks Ulli -- ----------------- Die Website Effizienzer ------------------ luna-park Bravo Sanchez, Vollmert, Wisser GbR Ulrich Wisser mailto:u.wisser@luna-park.de Alter Schlachthof, Immenburgstr. 20 Tel +49-228-9654055 D-53121 Bonn Fax +49-228-9654057 ------------------http://www.luna-park.de ------------------
----- Original Message ----- From: Ulrich Wisser <u.wisser@luna-park.de>
<dtml-if entryid>
evalutes true when
That's because 'entryid' contains the non-empty string '0', which evaluates as true. In order to evaluate false, it would need to be an integer. Try: http://server/dtml.doc?entryid:int=0 Cheers, Evan @ digicool
Evan Simpson wrote:
----- Original Message ----- From: Ulrich Wisser <u.wisser@luna-park.de>
<dtml-if entryid>
evalutes true when
That's because 'entryid' contains the non-empty string '0', which evaluates as true. In order to evaluate false, it would need to be an integer. Try:
As a slightly off-list-topic third-party followup, what html form would create the above URL if dhtml.doc was the action of that form? I'm having a problem that all my REQUEST variables are treated as strings, even when they are single digits. I would like to not have to coerce the variables in the destination DTML Method, but rather have the form set the type as above. Thanks... Bruce -- Bruce Elrick, Ph.D. Saltus Technology Consulting Group Personal: belrick@home.com IBM Certified Specialist Business: belrick@saltus.ab.ca ADSM, AIX Support, RS/6000 SP, HACMP
On Wed, 16 Feb 2000, Bruce Elrick wrote:
As a slightly off-list-topic third-party followup, what html form would create the above URL if dhtml.doc was the action of that form?
<form action="dtml.doc"> <input name="entryid:int" value="0"> </form>
I'm having a problem that all my REQUEST variables are treated as strings, even when they are single digits. I would like to not have to coerce the variables in the destination DTML Method, but rather have the form set the type as above.
See http://www.zope.org/Members/Zen/howto/FormVariableTypes Note that the caveat is, although the action method doesn't have to wastetime casting strings into their correct format, your users will see rather ugly error screens if they enter bad data. -- ___ // Zen (alias Stuart Bishop) Work: zen@cs.rmit.edu.au // E N Senior Systems Alchemist Play: zen@shangri-la.dropbear.id.au //__ Computer Science, RMIT WWW: http://www.cs.rmit.edu.au/~zen
Stuart 'Zen' Bishop wrote:
On Wed, 16 Feb 2000, Bruce Elrick wrote:
As a slightly off-list-topic third-party followup, what html form would create the above URL if dhtml.doc was the action of that form?
<form action="dtml.doc"> <input name="entryid:int" value="0"> </form>
I'm having a problem that all my REQUEST variables are treated as strings, even when they are single digits. I would like to not have to coerce the variables in the destination DTML Method, but rather have the form set the type as above.
See http://www.zope.org/Members/Zen/howto/FormVariableTypes
Note that the caveat is, although the action method doesn't have to wastetime casting strings into their correct format, your users will see rather ugly error screens if they enter bad data.
Thanks Stuart (and Evan). Fortunately my integers come from <select>'s in the forms so I can control the values. Now I can control the types too! Cheers... Bruce -- Bruce Elrick, Ph.D. Saltus Technology Consulting Group Personal: belrick@home.com IBM Certified Specialist Business: belrick@saltus.ab.ca ADSM, AIX Support, RS/6000 SP, HACMP
----- Original Message ----- From: Bruce Elrick <belrick@home.com>
As a slightly off-list-topic third-party followup, what html form would create the above URL if dhtml.doc was the action of that form?
I'm having a problem that all my REQUEST variables are treated as strings, even when they are single digits. I would like to not have to coerce the variables in the destination DTML Method, but rather have the form set the type as above.
Instead of naming your input field 'entryid', you name it 'entryid:int'. It's really that simple. Or, rather, it *starts* that simple and can get very complicated indeed as you get into stuff like 'fred.scores:int:list:record' (which creates an object 'fred' with attribute 'scores' containing a list of integers. I think.) For a quick & dirty example, make a Folder or DTML Document and give it a bunch of properties of different types. Then 'view source' on its property sheet! Cheers, Evan @ 4-am & digicool
Next question on making my menu... I'd like to store a property in any of my folders that specifies them as hidden. Then I need to be able to access that property from any other page to check if it's there and is true, if it is then I don't display it in the generated menu. If it's not there or if it's false then it can be displayed in the menu. Help? I think the important bit is that folders may not contain the property (so I don't have to add it to every new folder!). -- Roddy --- Roddy Vagg Programmer, Web Developer Cooperative Research Centre for Cattle and Beef Quality (and) Total Genetic Resource Management (TGRM) Ph: (+61)267733978 ---
Here's how I do it. It seems to work regardless of whether "noindex" is defined. -- Loren <!-- Begin Title List --> <ul> <!--#in "PARENTS[0].objectValues(['Folder'])" sort=title skip_unauthorized--> <!--#unless noindex--> <li><A HREF="<!--#var absolute_url-->"><!--#var title_or_id--></A></li> <!--#/unless--> <!--#/in--> </ul> <!-- End Title List -->
I'd like to store a property in any of my folders that specifies them as hidden. Then I need to be able to access that property from any other page to check if it's there and is true, if it is then I don't display it in the generated menu. If it's not there or if it's false then it can be displayed in the menu.
Help? I think the important bit is that folders may not contain the property (so I don't have to add it to every new folder!).
-- Roddy
Why use a property for this? The way I've done this in the past is to do this: <dtml-in "objectValues(['Folder'])" sort=title skip_unauthorized> <dtml-if "title != ''"> <a href="<dtml-var absolute_url>"><dtml-var title></a> </dtml-if> </dtml-in> Basically, if there is a title, display the folder. If there isn't a title, then don't display it.. HTH, Adam On 17-Feb-2000 Roddy wrote:
Next question on making my menu...
I'd like to store a property in any of my folders that specifies them as hidden. Then I need to be able to access that property from any other page to check if it's there and is true, if it is then I don't display it in the generated menu. If it's not there or if it's false then it can be displayed in the menu.
Help? I think the important bit is that folders may not contain the property (so I don't have to add it to every new folder!).
-- Roddy
--- Roddy Vagg Programmer, Web Developer Cooperative Research Centre for Cattle and Beef Quality (and) Total Genetic Resource Management (TGRM) Ph: (+61)267733978 ---
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
-- M. Adam Kendall | mak@kha0s.org | "There's never enough time to do http://kha0s.org | all the nothing you want." | --Bill Watterson (Calvin and Hobbes)
This is an option I suppose, though it's a shame to have to use a kludge like this for such a simple task. -- Roddy On Thu, 17 Feb 2000, M. Adam Kendall wrote: => Why use a property for this? The way I've done this in the past => is to do this: => => <dtml-in "objectValues(['Folder'])" sort=title skip_unauthorized> => <dtml-if "title != ''"> => <a href="<dtml-var absolute_url>"><dtml-var title></a> => </dtml-if> => </dtml-in> => => Basically, if there is a title, display the folder. If there isn't => a title, then don't display it.. => => HTH, => Adam => => On 17-Feb-2000 Roddy wrote: => > => > Next question on making my menu... => > => > I'd like to store a property in any of my folders that specifies them as => > hidden. Then I need to be able to access that property from any other page => > to check if it's there and is true, if it is then I don't display it in => > the generated menu. If it's not there or if it's false then it can be => > displayed in the menu. => > => > Help? I think the important bit is that folders may not contain the => > property (so I don't have to add it to every new folder!). => > => > -- Roddy => > => > => > --- => > Roddy Vagg => > Programmer, Web Developer => > Cooperative Research Centre for Cattle and Beef Quality => > (and) Total Genetic Resource Management (TGRM) => > Ph: (+61)267733978 => > --- => > => > => > _______________________________________________ => > Zope maillist - Zope@zope.org => > http://lists.zope.org/mailman/listinfo/zope => > ** No cross posts or HTML encoding! ** => > (Related lists - => > http://lists.zope.org/mailman/listinfo/zope-announce => > http://lists.zope.org/mailman/listinfo/zope-dev ) => => -- => M. Adam Kendall | => mak@kha0s.org | "There's never enough time to do => http://kha0s.org | all the nothing you want." => | --Bill Watterson (Calvin and Hobbes) => --- Roddy Vagg Programmer, Web Developer Cooperative Research Centre for Cattle and Beef Quality (and) Total Genetic Resource Management (TGRM) Ph: (+61)267733978 ---
participants (7)
-
Bruce Elrick -
Evan Simpson -
Loren Stafford -
M. Adam Kendall -
Roddy -
Stuart 'Zen' Bishop -
Ulrich Wisser