[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>&nbsp;</DIV>
<DIV>I am using the basic add entry form structure and result methods as follows:</DIV>
<DIV>&nbsp;</DIV>
<DIV>Add entry form looks like this:</DIV>
<DIV>&nbsp;</DIV>
<DIV>&lt;dtml-var standard_html_header&gt;<BR>&lt;h1&gt;Add a New Record&lt;/h1&gt;<BR>&lt;p&gt;<BR>&lt;a href="<A href='http://localhost:8080/CWServiceS2/index_html"><b>Main'>http://localhost:8080/CWServiceS2/index_html"&gt;&lt;b&gt;Main</A> Menu&lt;/b&gt;&lt;/a&gt;<BR>&lt;/p&gt;<BR>&lt;form action="result1_html" method=post&gt;<BR>&lt;table bgcolor="#CCCCCC" width="100%"&gt;<BR>&lt;tr&gt;<BR>&lt;td&gt;&lt;b&gt;Part Name:&lt;/b&gt;&lt;/td&gt;<BR>&lt;td&gt;&lt;input type="text" name="partname" size=20&gt;&lt;/td&gt;<BR>&lt;/tr&gt;<BR>&lt;tr&gt;<BR>&lt;td&gt;&lt;b&gt;Quantity:&lt;/b&gt;&lt;/td&gt;<BR>&lt;td&gt;&lt;input type="text" name="quantity:float" value="0000.00" size=50&gt;&lt;/td&gt;<BR>&lt;/tr&gt;<BR>&lt;tr&gt;<BR>&lt;td&gt;&lt;b&gt;Part Description:&lt;/b&gt;&lt;/td&gt;<BR>&lt;td&gt;&lt;input type="text" name="partdescription" size=50&gt;&lt;/td&gt;<BR>&lt;/tr&gt;<BR>&lt;tr&gt;<BR>&lt;td&gt;&lt;b&gt;Unit Price:&lt;/b&gt;&lt;/td&gt;<BR>&lt;td&gt;&lt;input type="text"
 name="unitprice:float" value="0000.00" size=50&gt;&lt;/td&gt;<BR>&lt;/tr&gt;<BR>&lt;tr&gt;<BR>&lt;td&gt;&lt;b&gt;Work Order ID:&lt;/b&gt;&lt;/td&gt;<BR>&lt;td&gt;&lt;input type="text" name="workorderid" size=50&gt;&lt;/td&gt;<BR>&lt;/tr&gt;<BR>&lt;tr&gt;<BR>&lt;td&gt;&lt;b&gt;Serial No:&lt;/b&gt;&lt;/td&gt;<BR>&lt;td&gt;&lt;input type="text" name="serialno" size=50&gt;&lt;/td&gt;<BR>&lt;/tr&gt;<BR>&lt;tr&gt;<BR>&lt;td colspan=2&gt;&lt;input type="submit" value="Add Record"&gt;&lt;/td&gt;<BR>&lt;/tr&gt;<BR>&lt;/table&gt;<BR>&lt;/form&gt;<BR>&lt;dtml-var standard_html_footer&gt;</DIV>
<DIV>&nbsp;</DIV>
<DIV>The result form looks like this:</DIV>
<DIV>&nbsp;</DIV>
<DIV>dtml-var standard_html_header&gt;<BR>&nbsp;&lt;dtml-try&gt;<BR>&nbsp; &lt;dtml-call "addRecord1(PARTNAME=_['partname'],<BR>QUANTITY=_['quantity'],<BR>PARTDESCRIPTION=_['partdescription'],<BR>UNITPRICE=_['unitprice'],<BR>WORKORDERID=_['workorderid'],<BR>SERIALNO=_['serialno'])"&gt;<BR>&nbsp;&lt;dtml-call "REQUEST.set('status', 'ok')"&gt;<BR>&nbsp;&lt;dtml-except&gt;<BR>&nbsp;&nbsp; &lt;dtml-call "REQUEST.set('status', 'failed')"&gt;<BR>&nbsp;&lt;/dtml-try&gt;<BR>&nbsp;&lt;dtml-if "_['status']=='ok'"&gt;<BR>&nbsp;&nbsp; &lt;h1&gt;New record was succesfully added.&lt;/h1&gt;<BR>&nbsp;&nbsp; &lt;form action="index_html"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp; &lt;input type="submit" value="OK"&gt;<BR>&nbsp;&nbsp; &lt;/form&gt;<BR>&nbsp;&lt;dtml-else&gt;<BR>&nbsp;&nbsp; &lt;h1&gt;Adding the new record failed. No record was added.&lt;/h1&gt;<BR>&nbsp;&nbsp; &lt;table&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp; &lt;tr&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 &lt;td&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;form action="addnewRecordForm1_html"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;input type="submit" value="Try again"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/form&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/td&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;form action="index_html"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;input type="submit" value="OK"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/form&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/td&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp; &lt;/tr&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;/table&gt;<BR>&nbsp;&lt;/dtml-if&gt;<BR>&nbsp;&lt;dtml-var standard_html_footer&gt;</DIV>
<DIV>&nbsp;</DIV>
<DIV>The SQL is :</DIV>
<DIV>&nbsp;</DIV>
<DIV>INSERT INTO tWorkorderParts<BR>(WORKORDERID, SERIALNO, PARTNAME, QUANTITY, PARTDESCRIPTION, UNITPRICE) </DIV>
<DIV>VALUES<BR>(&lt;dtml-sqlvar WORKORDERID type=int&gt;,<BR>&lt;dtml-sqlvar SERIALNO type=string&gt;,<BR>&lt;dtml-sqlvar PARTNAME type=string&gt;,<BR>&lt;dtml-sqlvar QUANTITY type=int&gt;,<BR>&lt;dtml-sqlvar PARTDESCRIPTION type=string&gt;,<BR>&lt;dtml-sqlvar UNITPRICE type=float&gt;)</DIV>
<DIV>&nbsp;</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>&nbsp;</DIV>
<DIV>Thanks,</DIV>
<DIV>&nbsp;</DIV>
<DIV>Rob Crotty</DIV>
<DIV>&nbsp;</DIV>
--0-779497748-1058998028=:74883--