See my responses below. Howard C. Shaw III Programmer/SysAdmin St. Thomas High School
---------- From: Tom Deprez[SMTP:Tom.Deprez@uz.kuleuven.ac.be] Sent: Tuesday, April 20, 1999 8:39 AM To: zope@zope.org Subject: [Zope] (no subject)
Hi all,
I use PostGreSQL (if you need to know)
1) the SQL Method :
INSERT INTO list VALUES (<!--#sqlvar item_string type=string--> ,<!--#sqlvar vendorcode_int type=int--> ,<!--#sqlvar quantity_int type=int-->)
seems to work fine (new data is entered in database) It only gives the result text of 'this was not a query'... how comes?
This is not a problem. All it means is that it did not result in a query object being returned. (I.e. there were no 'results')
2) I've made DTML Document with :
<FORM METHOD="post" ACTION="???????"> <TABLE BORDER="0"> <TR> <TD>New Item:</TD> <TD><INPUT NAME="item_string"></TD> </TR> <TR> <TD>Vendor:</TD> <TD><INPUT NAME="vendor_string"></TD> </TR> <TR> <TD>Quantity:</TD> <TD><INPUT NAME="quantity_int"></TD> </TR> </TABLE> <INPUT TYPE="submit"> </FORM>
3) How do I glue these together? So that when pressing submit the values are inserted in the database??
I've putted the SQL Method in the ACTION, but this doesn't seem to work.
You need to have the form names the same as the variables in your table, or use another DTML page to parse the results. That is, your vendor_string needs to be a vendor_int. See my response below to accomplish this.
4) Actualy It should return a new page with inserting of ... succesfull (inserting ... was not successfull)... how can this be done?
Can't help you here, except to say that if you use a second DTML page to call the SQL query, it can provide a customized response as well.
5) Instead of letting the user enter the vendorname (<INPUT NAME="vendor_string">), I would like to give him a combobox (<SELECT> NAME...). This combobox should be filled with the result of a query to all vendors in the database. How can this be done? i.e. Putting the result set of a query in a select box.
Create an SQL query 'venderlistdb' SELECT vendorname, vendorid FROM vendors ORDER by vendorname and in the DTML document with the form <select name=vendorcode_int size=5> <!--#in vendorlistdb--> <option value=<!--#var vendorcode-->><!--#var vendorname--> <!--#/in--> </select>
6) If I 5 can be done, the insert SQL should slightly change :
INSERT INTO list VALUES (<!--#sqlvar item_string type=string--> ,<!--#sqlvar vendorcode_int type=int--> ,<!--#sqlvar quantity_int type=int-->)
with the vendorcode_int comming from another sql :
select vendorcode from vendors WHERE <!--#sqltest vendor_name column=vendorname type=string-->
Don't need this extra select. With the snippet above, you show them the name, but you get the code.
How can this be done???
Help, can somebody help me with these?
Really thanks in advance!
Tom.
_______________________________________________ Zope maillist - Zope@zope.org http://www.zope.org/mailman/listinfo/zope
(For developer-specific issues, use the companion list, zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )
participants (1)
-
Shaw, Howard