[ZPT] Re: Passing ZSQL Method an argument/variable with ZPT
Daniel Tang
daniel.tang@chronicle.com
Thu, 20 Feb 2003 16:38:29 -0500 (EST)
Hello,
After using all these below... it seems that the variable being passed is
still not going through.
<select name="result" size="10" tal:define="jobclasses
python:here.get_id(my_id=request.form['id'])">
<select name="result" size="10" tal:define="jobclasses
python:here.get_id(my_id='${request.form.id}')">
<select name="result" size="10" tal:define="jobclasses
container/get_id(my_id=string('${request/form/id}'))">
<select name="result" size="10" tal:define="jobclasses
python:container.get_id(my_id=request.form['id'])">
<select name="result" size="10" tal:define="jobclasses
python:container.get_id(my_id={request.form['id']})">
The ZSQL method is: get_id
SELECT job_id FROM inventory WHERE (my_id = <dtml-sqlvar my_id
type="string">
Is this because of the variable being a particular typecast, like integer
vs. string? (I am using zope 2.5.0 on a red hat linux box).
Thanks,
--Daniel
DT> Is there something wrong with this?
yes :)
DT> <select name="result" size="10" tal:define="options
container/get_id(my_id={request.form['id']})">
becomes
<select name="result" size="10" tal:define="options
python:container.get_id(my_id={request.form['id']})">
... and i am not sure about using "options" as a variable name.. as it
is already in use..
:)
--
Geir Bkholt
---------- Forwarded message ----------
Date: Thu, 20 Feb 2003 16:01:32 -0500 (EST)
From: Daniel Tang <dtang@chronicle.com>
Reply-To: daniel.tang@chronicle.com
To: zpt@zope.org
Subject: Passing ZSQL Method an argument/variable with ZPT
Hello,
I am trying to send an argument to an SQL Method in my expression below,
but to no avail. I've tried numerous ways to include the variable which
is passed in by a form. Is there something wrong with this?
Page template:
<select name="result" size="10" tal:define="options container/get_id(my_id={request.form['id']})">
<option tal:repeat="option options"
tal:attributes="value option/job_id"
tal:content="option/job_id">job_id</option>
</select>
SQL Method:
Arguments: my_id
SELECT job_id FROM inventory WHERE (my_id = <dtml-sqlvar my_id type="string">
I get an error on trying to get the results. Any ideas?
TIA,
Daniel