[Zope] SQL Method running twice
Justin Dunsworth
justin.dunsworth at gmail.com
Thu Dec 10 13:59:43 EST 2009
I am running into a brand new issue today that I can't, for the life of me,
figure out. I wrote a standard page to insert data into a MySQL table using
Z SQL methods from a form like I always have but for some strange reason
it's running the same query twice, thus adding a duplicate entry.
I have confined the original code in it's own document, checked, double
checked, and still no avail. Here's the code for the page:
<dtml-var frame_header>
<dtml-if addnewstatus>
<dtml-try>
<dtml-call "RootSQLMethods.admin.Status_Add(_.None,_)">
<dtml-call "RESPONSE.redirect(BASE2+'/statuses')">
<dtml-except>
<p>Error while submitting! Status not added.</p>
<br>Error type: <dtml-var error_type>
<br>Error value: <dtml-var error_value>
</dtml-try>
</dtml-if>
<form action="&dtml-URL;" method="post">
<table class="tborder" align="center" width="30%" cellspacing="0" >
<tr><td class="tcat" align="center" colspan="2" style="font-size:
12pt;">Add New Status</td></tr>
<tr><td width="35%" align="right"><b>Name:</b></td><td
width="65%"><input type="text" name="name_add" size=15></td></tr>
<tr><td width="35%" align="right"
valign="top"><b>Description:</b></td><td width="65%"><textarea
name="description_add" cols=25 rows=4></textarea></td></tr>
<tr><td width="35%" align="right"><b>Sort:</b></td><td
width="65%"><input type="text" name="sort_add" value="5" size=1></td></tr>
<tr><td align="center" colspan="2"><hr></td></tr>
<tr>
<td><input type="hidden" name="addnewstatus" value="1"></td>
<td>
<button class="button" onclick="this.form.submit()">Add
Status</button>
<button class="button" onclick="window.location = '<dtml-var
BASE2>/statuses'; return false;">Cancel</button>
</td>
</tr>
</table>
</form>
<dtml-var frame_footer>
I can run the SQL Method by itself and it works just fine (only inserting it
once) but when run as a separate page it adds the two.
Any assistance is appreciated
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20091210/0e45cb64/attachment.html
More information about the Zope
mailing list