[Zope-DB] How to pass variables?

Keith Klein kklein@ix.netcom.com
Wed, 31 Dec 1969 16:00:00 0000 ()

Iam a newbies in zope I need some assistance with passing of variables.
Iam connecting to a Msql DB with student table, l need to be able to
display the student, delete and update them. I've several ZSQL and DTML
method as below to assist me to achieve that. The showstudent dtml methord
is refferancing the edit, delete and addstudent DTML Methods. The
Showstudent form has buttons for the above, but when l click on the Edit
Delete button l get "error value Student_ID". And both delete and edit
method gives me an error "Missing input variable Student_ID"
How do l go about doing this? How do l pass the Student_ID variable into
those Dtml method.
I will be grateful for your assistance

DTML Method "ListStudent" to list all student

<h2>Listing of Students</h2>
    <dtml-in SelectAll>
    <li><dtml-var Student_ID><dtml-var Name>
    <font size="-1"><a href="edit?Student_ID=<dtml-var
  href="delete?Student_ID=<dtml-var Student_ID>">Delete</a></font>
<a href="AddStudent">Add a New Student</a>

ZSQL Method "SelectAll" to select all  from student table

select * from Student

ZSQL Method "SelectStudent" to select one student

select * from Student where
Student_ID=<dtml-sqlvar Student_ID type="int">

ZSQL Method "UpdateStudent" to update student

Update Student set
Student_ID=<dtml-sqlvar Student_ID type="int">,
Name=<dtml-sqlvar Name type="string">,
Advisor_Name=<dtml-sqlvar Advisor_Name type="string">,
Grade=<dtml-sqlvar Grade type="string">,
Homeroom=<dtml-sqlvar Homeroom type="string">
where Student_ID=<dtml-sqlvar Student_ID type="int">

DTML Methord "delete" to delete a record

<dtml-var standard_html_header>

<dtml-call deleteMethord>
<h2>Student record deleted!</h2>
<a href="ListStudent">View a listing of students</a> or <a
href="AddStudent">Add another Student</a>
<dtml-var standard_html_footer>

ZSQL Methord to "deleteMethod" one row from student table

Delete from Student where Student_ID=<dtml-sqlvar Student_ID type="int">

DTML Method "edit" to edit a record

<dtm-var standard_html_header>

<dtml-if submit>

<dtml-call UpdateStudent>
<h2>Record Edited</h2>
<a href="ListStudent">View Student Listing</a><a href="AddStudent">Add
another Student</a>

<h2 align="center">Edit Student Record</h2>

<dtml-in SelectStudent>

<form action="edit" method="Post">
<table bgcolor="#00dcfd" align="center" border="6" cellpadding="3"
cellspacing="1" width="60%">
<th align="center">Student_ID</th>
<th align="center">Name</th>
<th align="center">Advisor_Name</th>
<th align="center">Grade</th>
<th align="center">Homeroom</th>
<td><input name="Student_ID" width="10" value="<dtml-var
<td><input name="Name" width="20" value="<dtml-var name="Name">"></td>
<td><input name="Advisor_Name" width=20 value="<dtml-var
<td><input name="Grade" width=10 value="<dtml-var name="Grade">"></td>
<td><input name="Homeroom" width=20 value="<dtml-var
<td colspan="5" align="center">
<input type="hidden" name="Student_ID" value=<dtml-var name="Student_ID">>
<input type="submit" name="submit" value="Edit Rec"></td></tr>
<dtml-var standard_html_footer>

DTML Method "ShowStudent" to display all student in a form with
Edit,Delete,Addstudent buttons.

<dtml-var standard_html_header>
<h2>Listing of Students</h2>
<table border="1" cellspacing="3" cellpadding="5" width="60%">
<td>Student Id</td><td>Student Name</td>
<dtml-in SelectAll>
   <table border="1" align="center" width="100%">
   <dtml-if sequence-even>
   <tr bgcolor="#0cbea4">
      <form action="." methord="get">
      <input type="checkbox" name="Student_ID" value="<dtml-var
      <td size="10" width="20%"><dtml-var Student_ID></td>
      <td size="45" width="100%"><dtml-var Name></td>
   <table border="0" width="40%">
   <td><form action="edit?Student_ID=<dtml-var Student_ID>" method="get">
       <input type="submit" name="edit" value="Edit"></form></td>
   <td><form action="delete?Student_ID=<dtml-var Student_ID>"
       <input type="submit" name="delete" value="Delete"><form></td>
   <td><form action="AddStudent" method="get">
       <input type="submit" name="AddStudent" value="Add A

Zope-DB mailing list
<a target=_blank