[Zope] passing values tp python script from a zope page template through a link

Dave Kuhlman dkuhlman at cutter.rexx.com
Fri Aug 27 18:03:18 EDT 2004


On Fri, Aug 27, 2004 at 03:37:55PM -0500, Laura McCord wrote:
> 
> I wrote a xmlrpclib server and client file but this is the first time I
> am trying to pass a value from my zope page template to my python script
> that executes a server sub routine.
> 
> Also, the python function should be triggered by a link. This is what I
> have so far:

I think I can get you part way there.

Create a <form> in your ZPT.  In the form, put <input>, <select>,
etc elements that have names corresponding to the parameter names of your
Python Script.  (Make them hidden if you do not want them visible
in the page.)  On the <form> element, give the action attribute the
name of your Python Script.

For example, suppose your Python Script is named "infoAction_py" and it
has a parameter list: "user_name, user_email".  You could use the following
form:

    <form action="infoAction_py">
        <p>Name: <input type="text" name="user_name"/></p>
        <p>Email: <input type="text" name="user_email"/></p>
        <p><input type="submit" name="submit" value=" Submit "></p>
    </form>

When you submit the page containing this form, Zope will call your
script (infoAction_py), provided it is in the same folder as your
ZPT/form.

Does that help?

Dave

[snip]

-- 
Dave Kuhlman
http://www.rexx.com/~dkuhlman


More information about the Zope mailing list