Click to See Complete Forum and Search --> : Cancel Button problem


kristie ann
02-20-2004, 11:33 AM
Hey,

I have a form that when submitted will update fields in a database. I also have a cancel button that should close the form so that no updates are made to the database.

The problem I am having is that when I click the cancel button the form is still submitted and the updates are made.
On the onclick of the Cancel button I have the following self.close()

buntine
02-20-2004, 11:59 AM
Have you set the cancel button up as follows?


<input type="button" name="cancel" value="Cancel" onclick="self.close();" />

kristie ann
02-20-2004, 02:25 PM
This is the line of code :
<input src ="../images/cancel_off.gif" alt="Cancel Details" type="image" onClick="self.close" >

CyCo
02-20-2004, 02:51 PM
...try this...

<input src ="../images/cancel_off.gif" alt="Cancel Details" type="image" onclick="self.close(); return false" />

buntine
02-20-2004, 03:00 PM
Your browser treats an image form control in the exact same way it treats a submit form control..

Take CyCo's advaise and add the 'return false' statement in. If that doesnt work, use a button control instead.

Regards,
Andrew Buntine.

kristie ann
02-20-2004, 03:20 PM
This is working perfectly - thanks a million ye guys are a great help. Thanks again