Forum Moderators: open
function whenReset()
{
if(confirm('This will lose your changes, do you want to continue?'))
{
document.customerSurveysListsMaintenanceForm.reset();
}
return false;
}
Any pointers will be appreciated!
Thanks for your time!
First of all:
Welcome to Webmaster World!
Why not change your <input type="reset" />
to a normal button <input type="button" />
and then attach the function to the onclick method of the button?
<script type="text/javascript">
<!--
function checkreset(){
if(confirm('This will lose your changes, do you want to continue?')){
//if click OK, reset the form, otherwise do nothing
document.forms[0].reset()
}
}
//-->
</script>
<style type="text/css">
</style>
</head>
<body>
<form method="post" action="" >
<input type="text" name="txt1" id="txt1" size="30" /><br />
<input type="text" name="txt2" id="txt2" size="30" />
<input type="submit" value="OK" />
<!--This is a normal button, not a reset button//-->
<input type="button" value="Reset" onclick="checkreset()" />
</form>
Hope this helps,
ajkimoto