[Zope-DB] Drop down menu from SQL query in dtml method
Robert Crotty
r_crotty@yahoo.com
Wed, 23 Jul 2003 15:07:08 -0700 (PDT)
--0-779497748-1058998028=:74883
Content-Type: text/plain; charset=us-ascii
Charlie,
I am using the basic add entry form structure and result methods as follows:
Add entry form looks like this:
<dtml-var standard_html_header>
<h1>Add a New Record</h1>
<p>
<a href="Main'>http://localhost:8080/CWServiceS2/index_html"><b>Main Menu</b></a>
</p>
<form action="result1_html" method=post>
<table bgcolor="#CCCCCC" width="100%">
<tr>
<td><b>Part Name:</b></td>
<td><input type="text" name="partname" size=20></td>
</tr>
<tr>
<td><b>Quantity:</b></td>
<td><input type="text" name="quantity:float" value="0000.00" size=50></td>
</tr>
<tr>
<td><b>Part Description:</b></td>
<td><input type="text" name="partdescription" size=50></td>
</tr>
<tr>
<td><b>Unit Price:</b></td>
<td><input type="text" name="unitprice:float" value="0000.00" size=50></td>
</tr>
<tr>
<td><b>Work Order ID:</b></td>
<td><input type="text" name="workorderid" size=50></td>
</tr>
<tr>
<td><b>Serial No:</b></td>
<td><input type="text" name="serialno" size=50></td>
</tr>
<tr>
<td colspan=2><input type="submit" value="Add Record"></td>
</tr>
</table>
</form>
<dtml-var standard_html_footer>
The result form looks like this:
dtml-var standard_html_header>
<dtml-try>
<dtml-call "addRecord1(PARTNAME=_['partname'],
QUANTITY=_['quantity'],
PARTDESCRIPTION=_['partdescription'],
UNITPRICE=_['unitprice'],
WORKORDERID=_['workorderid'],
SERIALNO=_['serialno'])">
<dtml-call "REQUEST.set('status', 'ok')">
<dtml-except>
<dtml-call "REQUEST.set('status', 'failed')">
</dtml-try>
<dtml-if "_['status']=='ok'">
<h1>New record was succesfully added.</h1>
<form action="index_html">
<input type="submit" value="OK">
</form>
<dtml-else>
<h1>Adding the new record failed. No record was added.</h1>
<table>
<tr>
<td>
<form action="addnewRecordForm1_html">
<input type="submit" value="Try again">
</form>
</td>
<td>
<form action="index_html">
<input type="submit" value="OK">
</form>
</td>
</tr>
</table>
</dtml-if>
<dtml-var standard_html_footer>
The SQL is :
INSERT INTO tWorkorderParts
(WORKORDERID, SERIALNO, PARTNAME, QUANTITY, PARTDESCRIPTION, UNITPRICE)
VALUES
(<dtml-sqlvar WORKORDERID type=int>,
<dtml-sqlvar SERIALNO type=string>,
<dtml-sqlvar PARTNAME type=string>,
<dtml-sqlvar QUANTITY type=int>,
<dtml-sqlvar PARTDESCRIPTION type=string>,
<dtml-sqlvar UNITPRICE type=float>)
What I want to do is add a drop down choice for the partname (part number) because it is updated in the MS Access database frequently.. I will then change this so the description and unit price is pull from access versus all manual entry.
Thanks,
Rob Crotty
--0-779497748-1058998028=:74883
Content-Type: text/html; charset=us-ascii
<DIV>Charlie,</DIV>
<DIV> </DIV>
<DIV>I am using the basic add entry form structure and result methods as follows:</DIV>
<DIV> </DIV>
<DIV>Add entry form looks like this:</DIV>
<DIV> </DIV>
<DIV><dtml-var standard_html_header><BR><h1>Add a New Record</h1><BR><p><BR><a href="<A href='http://localhost:8080/CWServiceS2/index_html"><b>Main'>http://localhost:8080/CWServiceS2/index_html"><b>Main</A> Menu</b></a><BR></p><BR><form action="result1_html" method=post><BR><table bgcolor="#CCCCCC" width="100%"><BR><tr><BR><td><b>Part Name:</b></td><BR><td><input type="text" name="partname" size=20></td><BR></tr><BR><tr><BR><td><b>Quantity:</b></td><BR><td><input type="text" name="quantity:float" value="0000.00" size=50></td><BR></tr><BR><tr><BR><td><b>Part Description:</b></td><BR><td><input type="text" name="partdescription" size=50></td><BR></tr><BR><tr><BR><td><b>Unit Price:</b></td><BR><td><input type="text"
name="unitprice:float" value="0000.00" size=50></td><BR></tr><BR><tr><BR><td><b>Work Order ID:</b></td><BR><td><input type="text" name="workorderid" size=50></td><BR></tr><BR><tr><BR><td><b>Serial No:</b></td><BR><td><input type="text" name="serialno" size=50></td><BR></tr><BR><tr><BR><td colspan=2><input type="submit" value="Add Record"></td><BR></tr><BR></table><BR></form><BR><dtml-var standard_html_footer></DIV>
<DIV> </DIV>
<DIV>The result form looks like this:</DIV>
<DIV> </DIV>
<DIV>dtml-var standard_html_header><BR> <dtml-try><BR> <dtml-call "addRecord1(PARTNAME=_['partname'],<BR>QUANTITY=_['quantity'],<BR>PARTDESCRIPTION=_['partdescription'],<BR>UNITPRICE=_['unitprice'],<BR>WORKORDERID=_['workorderid'],<BR>SERIALNO=_['serialno'])"><BR> <dtml-call "REQUEST.set('status', 'ok')"><BR> <dtml-except><BR> <dtml-call "REQUEST.set('status', 'failed')"><BR> </dtml-try><BR> <dtml-if "_['status']=='ok'"><BR> <h1>New record was succesfully added.</h1><BR> <form action="index_html"><BR> <input type="submit" value="OK"><BR> </form><BR> <dtml-else><BR> <h1>Adding the new record failed. No record was added.</h1><BR> <table><BR> <tr><BR>
<td><BR> <form action="addnewRecordForm1_html"><BR> <input type="submit" value="Try again"><BR> </form><BR> </td><BR> <td><BR> <form action="index_html"><BR> <input type="submit" value="OK"><BR> </form><BR> </td><BR> </tr><BR> </table><BR> </dtml-if><BR> <dtml-var standard_html_footer></DIV>
<DIV> </DIV>
<DIV>The SQL is :</DIV>
<DIV> </DIV>
<DIV>INSERT INTO tWorkorderParts<BR>(WORKORDERID, SERIALNO, PARTNAME, QUANTITY, PARTDESCRIPTION, UNITPRICE) </DIV>
<DIV>VALUES<BR>(<dtml-sqlvar WORKORDERID type=int>,<BR><dtml-sqlvar SERIALNO type=string>,<BR><dtml-sqlvar PARTNAME type=string>,<BR><dtml-sqlvar QUANTITY type=int>,<BR><dtml-sqlvar PARTDESCRIPTION type=string>,<BR><dtml-sqlvar UNITPRICE type=float>)</DIV>
<DIV> </DIV>
<DIV>What I want to do is add a drop down choice for the partname (part number) because it is updated in the MS Access database frequently.. I will then change this so the description and unit price is pull from access versus all manual entry.</DIV>
<DIV> </DIV>
<DIV>Thanks,</DIV>
<DIV> </DIV>
<DIV>Rob Crotty</DIV>
<DIV> </DIV>
--0-779497748-1058998028=:74883--