Zope And MySQL - Submitting To The King
(Page 7 of 9 )
If you're familiar with DTML, you'll know that the two objects above can be combined into a single one by creative use of an "if" conditional test keyed to the form's "submit" variable. And that's exactly what I've done next - a DTML Method named "add" which includes both the initial form and the form processor.
<dtml-var standard_html_header>
<dtml-if submit>
<dtml-call insertMethod>
<h2>Item
added!</h2>
<p>
<a href="list">View the entire collection</a> or
<a href="add">add
another title</a>
<dtml-else>
<h2>Add DVD</h2>
<form
action="add" method="POST">
<table border=0>
<tr>
<td>Title</td>
<td><input
name="title" width=30 value=""></td>
</tr>
<tr>
<td>Director</td>
<td><input
name="director" width=30 value=""></td>
</tr>
<tr>
<td>Cast</td>
<td><input
name="cast" width=30 value=""></td>
</tr>
<tr>
<td>Genre</td>
<td><input
name="genre" width=30 value=""></td>
</tr>
<tr>
<td colspan=2 align=center>
<input
type="submit" name="submit" value="Add DVD">
</td>
</tr>
</table>
</form>
</dtml-if>
<dtml-var
standard_html_footer>
Using this two-in-one technique can reduce the number of objects in your collection,
and perhaps make things easier on the eyes.
Next: Erasing The Past >>
More Zope Articles
More By icarus, (c) Melonfire