dtml-if fustration!
Hi all, I have a fustrating problem with dtml-if's!! I've tried to work round it in many ways, but there is probably an easy one I am overlooking knowing my luck... Anyway... Consider the following dtml-if statement: <dtml-if SelectSID> SelectSID = <dtml-var SelectSID> <dtml-call "REQUEST.set('SelectSID', SelectSID)"> </dtml-if> This works okay, and stores the variable SelectSID in the request for the code to pick up again on it's next pass. However, on the next pass, the variable SelectSID doesn't exist! As the variable is now REQUEST.SelectSID - and the following code doesn't work.... <dtml-if "REQUEST.SelectSID"> SelectSID = <dtml-var SelectSID> <dtml-call "REQUEST.set('SelectSID', REQUEST.SelectSID)"> </dtml-if> ...as an error is thrown up if REQUEST.SelectSID doesn't exist! Anybody got a simple answer to my dilemma?!! Many thanks for any help! Regards, Greg Conway. This electronic transmission and any files attached to it are strictly confidential and intended solely for the addressee. If you are not the intended addressee, you must not disclose, copy or take any action in reliance of this transmission. If you have received this transmission in error, please notify us by return and delete the same. Further enquiries/returns can be posted to postmaster@gmlnt.com Thank you.
...as an error is thrown up if REQUEST.SelectSID doesn't exist!
Anybody got a simple answer to my dilemma?!!
Not sure, but have you tried either of; REQUEST['SelectSID'] REQUEST.get('SelectSID') Don't know if that'll fix you up though. tim
Hi Tim, Thanks - I couldn't get either of them to work, but whilst trying, realised (rather foolishy!) that I can of course do this.... <dtml-if SelectSID> SelectSID = <dtml-var SelectSID> <input type=hidden name=SelectSID value=<dtml-var SelectSID>> </dtml-if> ...which as I am doing this inside forms, solved the problem! at least in the current project... so if anybody has got an answer, I will still need it when I go back to other projects, I feel! but thanks for the response anyway! :) Regards, Greg.
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Tim Hicks Sent: 24 August 2002 18:12 To: Greg Conway; Zope@Zope. Org Subject: Re: [Zope] dtml-if fustration!
...as an error is thrown up if REQUEST.SelectSID doesn't exist!
Anybody got a simple answer to my dilemma?!!
Not sure, but have you tried either of;
REQUEST['SelectSID'] REQUEST.get('SelectSID')
Don't know if that'll fix you up though.
tim
_______________________________________________ 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 )
This electronic transmission and any files attached to it are strictly confidential and intended solely for the addressee. If you are not the intended addressee, you must not disclose, copy or take any action in reliance of this transmission. If you have received this transmission in error, please notify us by return and delete the same. Further enquiries/returns can be posted to postmaster@gmlnt.com Thank you.
Hi Tim,
Thanks - I couldn't get either of them to work, but whilst trying, realised (rather foolishy!) that I can of course do this....
<dtml-if SelectSID> SelectSID = <dtml-var SelectSID> <input type=hidden name=SelectSID value=<dtml-var SelectSID>> </dtml-if>
...which as I am doing this inside forms, solved the problem! at least in the current project...
so if anybody has got an answer, I will still need it when I go back to other projects, I feel!
but thanks for the response anyway! :)
Oh, so you were trying to pass SelectSID between REQUESTS, not just use the variable further down the page. In that case, the hidden form field is a good solution. That or using the session machinery. tim
What is the "next pass"?. Do you mean within the same page? If so, you don't need to declare the variable, as long as it's been already defined for the whole page. Just use <dtml-var SelectSID> anywhere. Now, if you need to change its value, and then use it on the remaining portion on the rendered page, the anwser is the same, use <dtml-var SelectSID>. You don't need to use the "REQUEST.SelectSID" part. Ausum ----- Original Message ----- From: "Greg Conway" <greg@gmlnt.com> To: "Zope@Zope. Org" <zope@zope.org> Sent: Saturday, August 24, 2002 11:56 AM Subject: [Zope] dtml-if fustration!
Hi all,
I have a fustrating problem with dtml-if's!! I've tried to work round it in many ways, but there is probably an easy one I am overlooking knowing my luck...
Anyway... Consider the following dtml-if statement:
<dtml-if SelectSID> SelectSID = <dtml-var SelectSID> <dtml-call "REQUEST.set('SelectSID', SelectSID)"> </dtml-if>
This works okay, and stores the variable SelectSID in the request for the code to pick up again on it's next pass.
However, on the next pass, the variable SelectSID doesn't exist! As the variable is now REQUEST.SelectSID - and the following code doesn't work....
<dtml-if "REQUEST.SelectSID"> SelectSID = <dtml-var SelectSID> <dtml-call "REQUEST.set('SelectSID', REQUEST.SelectSID)"> </dtml-if>
...as an error is thrown up if REQUEST.SelectSID doesn't exist!
Anybody got a simple answer to my dilemma?!!
Many thanks for any help!
Regards,
Greg Conway.
This electronic transmission and any files attached to it are strictly confidential and intended solely for the addressee. If you are not the intended addressee, you must not disclose, copy or take any action in reliance of this transmission. If you have received this transmission in error, please notify us by return and delete the same. Further enquiries/returns can be posted to postmaster@gmlnt.com Thank you.
_______________________________________________ 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 )
Hi Ausum, Thanks for the reply. What I actually mean is - the name of the variable I want the value of is stored inside another variable, in the request. For example... REQUEST.StoredVar[1] contains SelectStudentID and I want to perform a dtml-if condition based on whether SelectStudentID contains a value or not! So to get this value I perform a '_.getattr(REQUEST,StoredVar[1])' command. But I cannot seem to do this within a <dtml-if ... > statement, it throws up an error if the variable does not exist, presumably because I'm trying to work through an extra layer of variables.... just to make life complicated :) hope this is now clearer, any help much appreciated! Regards, Greg.
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Ausum Studio Sent: 24 August 2002 18:39 To: zope@zope.org Subject: Re: [Zope] dtml-if fustration!
What is the "next pass"?. Do you mean within the same page? If so, you don't need to declare the variable, as long as it's been already defined for the whole page. Just use <dtml-var SelectSID> anywhere.
Now, if you need to change its value, and then use it on the remaining portion on the rendered page, the anwser is the same, use <dtml-var SelectSID>. You don't need to use the "REQUEST.SelectSID" part.
Ausum
----- Original Message ----- From: "Greg Conway" <greg@gmlnt.com> To: "Zope@Zope. Org" <zope@zope.org> Sent: Saturday, August 24, 2002 11:56 AM Subject: [Zope] dtml-if fustration!
Hi all,
I have a fustrating problem with dtml-if's!! I've tried to work round it in many ways, but there is probably an easy one I am overlooking knowing my luck...
Anyway... Consider the following dtml-if statement:
<dtml-if SelectSID> SelectSID = <dtml-var SelectSID> <dtml-call "REQUEST.set('SelectSID', SelectSID)"> </dtml-if>
This works okay, and stores the variable SelectSID in the request for the code to pick up again on it's next pass.
However, on the next pass, the variable SelectSID doesn't exist! As the variable is now REQUEST.SelectSID - and the following code doesn't work....
<dtml-if "REQUEST.SelectSID"> SelectSID = <dtml-var SelectSID> <dtml-call "REQUEST.set('SelectSID', REQUEST.SelectSID)"> </dtml-if>
...as an error is thrown up if REQUEST.SelectSID doesn't exist!
Anybody got a simple answer to my dilemma?!!
Many thanks for any help!
Regards,
Greg Conway.
This electronic transmission and any files attached to it are strictly confidential and intended solely for the addressee. If you are not the intended addressee, you must not disclose, copy or take any action in reliance of this transmission. If you have received this transmission in error, please notify us by return and delete the same. Further enquiries/returns can be posted to postmaster@gmlnt.com Thank you.
_______________________________________________ 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 )
_______________________________________________ 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 )
This electronic transmission and any files attached to it are strictly confidential and intended solely for the addressee. If you are not the intended addressee, you must not disclose, copy or take any action in reliance of this transmission. If you have received this transmission in error, please notify us by return and delete the same. Further enquiries/returns can be posted to postmaster@gmlnt.com Thank you.
<dtml-if "REQUEST.StoredVar.has_key('SelectStudentID') and REQUEST.StoredVar.SelectStudentID is not None"> do something when SelectStudebtID has any value </dtml-if> or <dtml-if "_.hasattr(REQUEST.StoredVar, 'SelectStudentID') and REQUEST.StoredVar.SelectStudentID is not None"> do something when SelectStudebtID has any value </dtml-if> Ausum ----- Original Message ----- From: "Greg Conway" <greg@gmlnt.com> To: "Ausum Studio" <ausum_studio@hotmail.com> Cc: "Zope@Zope. Org" <zope@zope.org> Sent: Sunday, August 25, 2002 11:24 AM Subject: RE: [Zope] dtml-if fustration!
Hi Ausum,
Thanks for the reply. What I actually mean is - the name of the variable I want the value of is stored inside another variable, in the request.
For example...
REQUEST.StoredVar[1] contains SelectStudentID
and I want to perform a dtml-if condition based on whether SelectStudentID contains a value or not!
So to get this value I perform a '_.getattr(REQUEST,StoredVar[1])' command.
But I cannot seem to do this within a <dtml-if ... > statement, it throws up an error if the variable does not exist, presumably because I'm trying to work through an extra layer of variables....
just to make life complicated :)
hope this is now clearer, any help much appreciated!
Regards,
Greg.
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Ausum Studio Sent: 24 August 2002 18:39 To: zope@zope.org Subject: Re: [Zope] dtml-if fustration!
What is the "next pass"?. Do you mean within the same page? If so, you don't need to declare the variable, as long as it's been already defined for the whole page. Just use <dtml-var SelectSID> anywhere.
Now, if you need to change its value, and then use it on the remaining portion on the rendered page, the anwser is the same, use <dtml-var SelectSID>. You don't need to use the "REQUEST.SelectSID" part.
Ausum
----- Original Message ----- From: "Greg Conway" <greg@gmlnt.com> To: "Zope@Zope. Org" <zope@zope.org> Sent: Saturday, August 24, 2002 11:56 AM Subject: [Zope] dtml-if fustration!
Hi all,
I have a fustrating problem with dtml-if's!! I've tried to work round it in many ways, but there is probably an easy one I am overlooking knowing my luck...
Anyway... Consider the following dtml-if statement:
<dtml-if SelectSID> SelectSID = <dtml-var SelectSID> <dtml-call "REQUEST.set('SelectSID', SelectSID)"> </dtml-if>
This works okay, and stores the variable SelectSID in the request for the code to pick up again on it's next pass.
However, on the next pass, the variable SelectSID doesn't exist! As the variable is now REQUEST.SelectSID - and the following code doesn't work....
<dtml-if "REQUEST.SelectSID"> SelectSID = <dtml-var SelectSID> <dtml-call "REQUEST.set('SelectSID', REQUEST.SelectSID)"> </dtml-if>
...as an error is thrown up if REQUEST.SelectSID doesn't exist!
Anybody got a simple answer to my dilemma?!!
Many thanks for any help!
Regards,
Greg Conway.
This electronic transmission and any files attached to it are strictly confidential and intended solely for the addressee. If you are not the intended addressee, you must not disclose, copy or take any action in reliance of this transmission. If you have received this transmission in error, please notify us by return and delete the same. Further enquiries/returns can be posted to postmaster@gmlnt.com Thank you.
_______________________________________________ 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 )
_______________________________________________ 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 )
This electronic transmission and any files attached to it are strictly confidential and intended solely for the addressee. If you are not the intended addressee, you must not disclose, copy or take any action in reliance of this transmission. If you have received this transmission in error, please notify us by return and delete the same. Further enquiries/returns can be posted to postmaster@gmlnt.com Thank you.
_______________________________________________ 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 )
This statement will check to see if SelectSID contains a value, if true, it will set the value, if false, it will not. I'm not really sure of what you're trying to do with [ SelectSID = <dtml-var SelectSID> ] <dtml-if expr="selectSID"> <dtml-call "REQUEST.set('SelectSID',SelectSID)"> </dtml-if> Michael On Saturday 24 August 2002 10:56 am, Greg Conway wrote:
Hi all,
I have a fustrating problem with dtml-if's!! I've tried to work round it in many ways, but there is probably an easy one I am overlooking knowing my luck...
Anyway... Consider the following dtml-if statement:
<dtml-if SelectSID> SelectSID = <dtml-var SelectSID> <dtml-call "REQUEST.set('SelectSID', SelectSID)"> </dtml-if>
This works okay, and stores the variable SelectSID in the request for the code to pick up again on it's next pass.
However, on the next pass, the variable SelectSID doesn't exist! As the variable is now REQUEST.SelectSID - and the following code doesn't work....
<dtml-if "REQUEST.SelectSID"> SelectSID = <dtml-var SelectSID> <dtml-call "REQUEST.set('SelectSID', REQUEST.SelectSID)"> </dtml-if>
...as an error is thrown up if REQUEST.SelectSID doesn't exist!
Anybody got a simple answer to my dilemma?!!
Many thanks for any help!
Regards,
Greg Conway.
This electronic transmission and any files attached to it are strictly confidential and intended solely for the addressee. If you are not the intended addressee, you must not disclose, copy or take any action in reliance of this transmission. If you have received this transmission in error, please notify us by return and delete the same. Further enquiries/returns can be posted to postmaster@gmlnt.com Thank you.
_______________________________________________ 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 )
Hi Michael, Okay, here is a prime example of what I am trying to achieve! here's the code... (it's a snippet of a DTML method) <dtml-if "_.getattr(REQUEST,REQUEST.Variable)"> <dtml-in "REQUEST.CustomLinkFields"> <dtml-let Counter=sequence-index> <dtml-var "REQUEST.CustomLinkFields[Counter]">=<dtml-var "_.int(_.getattr(REQUEST,REQUEST.Variable))"> </dtml-let> </dtml-in> </dtml-if> "Variable" as var in memory, let's say it contains "SelectStudentID". Now... sometimes this DTML method (form) will be called from another form so the variable "Variable" set, and other times this variable will not be set! The idea is the middle line of code should print the contents of the variable "SelectStudentID" - if it exists. If it doesn't, I want Zope to ignore this line of code. I have to put the code [ _.getattr() ] inside quotes [ " ... " ], but if I do this then errors occur when I call the form without this variable set - as it doesn't exist. I got round the problem by hard-coding the variable name into the page, but I don't want to do this, I want DTML to look up the value for me, and act based on whether there is such a variable stored in the request, the way a normal <dtml-if Variable> would work - by not throwing up an error if the variable doesn't exist!! Hope this is now clearer, any enlightenment much appreciated!! Regards, Greg.
-----Original Message----- From: Michael [mailto:michael@nichestaffing.com] Sent: 24 August 2002 20:15 To: Greg Conway; Zope@Zope. Org Subject: Re: [Zope] dtml-if fustration!
This statement will check to see if SelectSID contains a value, if true, it will set the value, if false, it will not. I'm not really sure of what you're trying to do with [ SelectSID = <dtml-var SelectSID> ]
<dtml-if expr="selectSID"> <dtml-call "REQUEST.set('SelectSID',SelectSID)"> </dtml-if>
Michael
On Saturday 24 August 2002 10:56 am, Greg Conway wrote:
Hi all,
I have a fustrating problem with dtml-if's!! I've tried to work round it in many ways, but there is probably an easy one I am overlooking knowing my luck...
Anyway... Consider the following dtml-if statement:
<dtml-if SelectSID> SelectSID = <dtml-var SelectSID> <dtml-call "REQUEST.set('SelectSID', SelectSID)"> </dtml-if>
This works okay, and stores the variable SelectSID in the request for the code to pick up again on it's next pass.
However, on the next pass, the variable SelectSID doesn't exist! As the variable is now REQUEST.SelectSID - and the following code doesn't work....
<dtml-if "REQUEST.SelectSID"> SelectSID = <dtml-var SelectSID> <dtml-call "REQUEST.set('SelectSID', REQUEST.SelectSID)"> </dtml-if>
...as an error is thrown up if REQUEST.SelectSID doesn't exist!
Anybody got a simple answer to my dilemma?!!
Many thanks for any help!
Regards,
Greg Conway.
This electronic transmission and any files attached to it are strictly confidential and intended solely for the addressee. If you are not the intended addressee, you must not disclose, copy or take any action in reliance of this transmission. If you have received this transmission in error, please notify us by return and delete the same. Further enquiries/returns can be posted to postmaster@gmlnt.com Thank you.
_______________________________________________ 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 )
This electronic transmission and any files attached to it are strictly confidential and intended solely for the addressee. If you are not the intended addressee, you must not disclose, copy or take any action in reliance of this transmission. If you have received this transmission in error, please notify us by return and delete the same. Further enquiries/returns can be posted to postmaster@gmlnt.com Thank you.
participants (4)
-
Ausum Studio -
Greg Conway -
Michael -
Tim Hicks