[Zope] Altering values from HTML forms before SQL insert
Neil Bartlett
nbartlett@algorithmics.com
Thu, 17 Feb 2000 14:50:21 -0500
I have a HTML form that returns a value that I need to alter before I pass
it to a SQLMethod.
To do this I created I've assumed I should use either dtml-with or dtml-let
to create a new variable with my desired value and then call the SQL MEthod
within the dtml-with.
Some sample code is as follows.
SQLMethod:
ID:odbcInsertTalk
arguments: LocationAndTime
Query:
insert into talk (LocationAndTime) values (
<dtml-sqlvar LocationAndTime type=string>
)
DTML Document:
<dtml-var standard_html_header>
<dtml-with "_.namespace(LocationAndTime=Location+'--now')">
<dtml-comment>
<dtml-call odbcInsertTalk>
</dtml-comment>
<ul>
<li>Location: [<dtml-var LocationAndTime>]
</ul>
</dtml-with>
<dtml-var standard_html_footer>
I get my desired values for LocationAndTime for the code as shown however,
if I uncomment
<dtml-call odbcInsertTalk>
then I get a complaint
Error Type: Bad Request
Error Value: ['LocationAndTime']
odbcInsertTalk works fine when I test directly from the SQLMethod manager
page. I t also works if I remove the <dtml-with> and change the HTML form to
send the exact name (of course this does not have the value I want but it
does get correctly added to the DB)
I'm using ODBC DA version ZODBCDA-3.1.0b2-win32-x86.tgz.
Zope version: Zope 2.1.4 (binary release, python 1.5.2, win32-x86)
Python version: 1.5.2 (#0, Jul 30 1999, 09:52:18) [MSC 32 bit (Intel)]
System Platform: win32
Process ID: 217 (264)
Running for: 3 hours 24 min 35 sec
Any help would be very apprecitated.
Neil Bartlett