Passing parameters to methods - how to?
Hi! I'm making my own user managements methods, and I'm stucked with a (simple) problem: How do I call another DHTML method, passing parameters to it, in HTML? I'm using a DTML Method that gives me a list of usernames. I want to click on the username and get the properties for that username. I wrote another DTML Method to do that, but I don't know how to pass the username to this second DTML Method. The username list page have, for every user, a line like that (suppose two usernames, fred and jorge): <a href="ManageUserProperties">fred</a><br> <a href="ManageUserProperties">jorge</a><br> How do I pass the username to the ManageUserProperties DTML Method? I have tried to use something like: <a href="ManageUserProperties?username=fred">fred</a><br> <a href="ManageUserProperties?username=jorge">jorge</a><br> It works, but the ManageUserProperties DTML Method have another form in it, that calls itself, using the POST method: <form action="ManageUserProperties" method="POST"> Clicking in the "submit" button, it gives me an error, telling that 'username' is not defined. So I included an hidden field with name="username" and value="<dtml-var username>", but I'm thinking this is not the better way to do that... Can someone helps me? TIA -- César A. K. Grossmann ckant@usa.net http://members.xoom.com/ckant/ http://www.halcyon.com/sciclub/cgi-pvt/instr/instr.html
Hi Cesar !
Clicking in the "submit" button, it gives me an error, telling that 'username' is not defined. So I included an hidden field with name="username" and value="<dtml-var username>", but I'm thinking this is not the better way to do that...
Can someone helps me?
To my knowledge, it's the only way to do it, and if it works, why bother ? Regards, Maik -- Uzopia - Digging la vida Zopa - http://uzopia.editthispage.com
Maik Roeder wrote:
Clicking in the "submit" button, it gives me an error, telling that 'username' is not defined. So I included an hidden field with name="username" and value="<dtml-var username>", but I'm thinking this is not the better way to do that...
To my knowledge, it's the only way to do it, and if it works, why bother ?
And from the first link, there are a way to include such a hidden field when calling a link? That is the real question: how to substitute the '<a href="ManageUserProperties?username=someuser">someuser</a>' using hidden fields? ManageUserProperties is an DTML method, and are differents calls, with differents usernames in the same page (if I put a hidden field it's value will be the same to all the calls to the DTML Method in question). I'm thinking that maintaining some "session attributes" in a cookie is another idea, and sustitute the direct call to the method to a call to a JavaScript, but I don't want to use the most complicated method... []s -- +---------------------------------+---------------------------------+ | César A. K. Grossmann | Capacitação Solidária | | ckant@fazenda.gov.br | http://www.uol.com.br/umminuto/ | | http://members.xoom.com/ckant/ | Clique e doe - é de graça | +---------------------------------+---------------------------------+ http://www.halcyon.com/sciclub/cgi-pvt/instr/instr.html If you know the answer to a question, don't ask. -- Petersen Nesbit
"César A. K. Grossmann" wrote:
Maik Roeder wrote:
Clicking in the "submit" button, it gives me an error, telling that 'username' is not defined. So I included an hidden field with name="username" and value="<dtml-var username>", but I'm thinking this is not the better way to do that...
That is the real question: how to substitute the '<a href="ManageUserProperties?username=someuser">someuser</a>' using hidden fields? M
I'm thinking that maintaining some "session attributes" in a cookie is another idea, and sustitute the direct call to the method to a call to a JavaScript, but I don't want to use the most complicated method...
There are only two ways of doing this: 1) hidden form inputs 2) cookies 3) session variables (kind of like number 2) Using the former solution, you can make your link be the submit button for the form, either by using Javascript (yuk: <a href="javascript:document.forms['myform'].submit()">someuser</a>) or by making it a graphical button rather than a text link (<input type=button, img="button.gif"> as far as I remember, but I might be wrong). Why use javascript to access cookies? You can set and get them purely using zope. http://www.zope.org/Members/BwanaZulia/cookies. Also, why not install a session product (HappySession, FSSession, SQLSession...), it'll probably make your life easier in the long run... seb
Why use javascript to access cookies? You can set and get them purely using zope. http://www.zope.org/Members/BwanaZulia/cookies. Also, why not install a session product (HappySession, FSSession, SQLSession...), it'll probably make your life easier in the long run...
seb
Yes, and if you choose to use FSSession, remember to rename the object to something other that "FSSession". Having an object called "FSSession" in more than one place can f**k things up in the namestack, so to be on the safe side, rename (note "rename") the FSSession object to something more unique after having created one. This caused me a lot of brain damage, and I had it explained by a friend after may failed attempts to understand the error messages.
participants (5)
-
Cesar A. K. Grossmann -
César A. K. Grossmann -
Maik Roeder -
Peter Bengtsson -
seb