Hi, 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. Larry McDonnell Proton Energy Systems 50 Inwood Rd. Rocky Hill, CT 06067 (860) 571-6533 ext. 531 Email:lmcdonnell@protonenergy.com www.protonenergy.com
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="">"> hth Ian PS It's 2am here so forgive me for any mistakes above but that should drive you in the right direction.
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
On Fri, 2002-04-26 at 08:27, McDonnell, Larry wrote:
Hi,
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.
This sounds like the exact issue I was dealing with a few weeks ago. I wanted to use one form for both input and review. Attached to this email are some files that make up my solution. The basic idea is to have a generic form that gets included either by the input or the edit pages. I also have a python script included that populates the REQUEST object with the results from the database. What I'm doing here is quite possibly the clumsy way to solve the problem, but it worked for me. (I've since moved on to a more ZPT centric way of doing things). The 'edit' page is the primary page, and calls all the others. I hope this helps. -- Colin Fox cfox@crystalcherry.com CF Consulting Inc. GPG Fingerprint: D8F0 84E7 E7CC 5C6C 9982 F1A7 A3EB 6EA3 BC97 572F
participants (4)
-
Colin Fox -
hans -
Ian J Cottee -
McDonnell, Larry