Ian J Cottee wrote:
Hi Larry
"McDonnell, Larry" <lmcdonnell@protonenergy.com> writes:
I am new to the Zope environment but I have been successful. I have been able to add odbc database connection and through a form input information to this database. Now I would like to view this information. I have set up z sql methods and I can see the info under the manage_test format. I would like to be able to re-populate my output form (its a copy of the input form but without the submit). I have gone through the zope book but maybe I missed something. Any examples or pointer I can use, thanks.
If I understand you correctly, you want to have a form that displays just one record on the screen? A very basic method would be to create one ZSQL method to get your item and one DTML Document to display it. So your SQL Method would look something like this
<params>pk</params> SELECT CODE, DESCRIPTION, PRICE FROM MYFILE WHERE ID = <dtml-sqlvar pk type=int>
Lets say that simple method is called sqlSelect
Now create a form in the same folder and it will look something like this (untested)
<dtml-var standard_html_header> <dtml-in sqlSelect> My Code Is: <dtml-var CODE null=""><br> My Description Is: <dtml-var DESCRIPTION null=""><br> My Price is: <dtml-var PRICE fmt="%3.2f" null="0.00"> </dtml-in> <dtml-var standard_html_footer>
If that form was called view_data you can call it with something like
http://my.web.server:8080/view_data?pk=1
Which would display the data for the record with an ID of 1. You won't get may design awards for the interface though ;-)
If you are putting the data back into the input fields you'd have just have stuff like
<input type="text" name="iDescription" value="<dtml-var DESCRIPTION null="">">
always worth noting: http://www.zope.org/Members/spinwing/ZSQL_Results -- ------------------------------------------------------------- Who's got only a hammer sees the world as a nail hans augustin (software developer) hans@beehive.de beehive elektronische medien GmbH http://www.beehive.de phone: +49 30 847-82 0 fax: +49 30 847-82 299