I used this button to clear the database. It works perfectly:
<input class="clearButton" type="button" value="Erase Data Now" onclick="clearData()">
However, it would be better to put it in a confirm dialog to prevent accidental use. So I used this line to open a dialog box:
<input class="clearButton" type="button" value="Clear Data" onclick="confirmation()">
I used this script for the dialog box:
<script type="text/javascript">
// Confirm Dialog box from http://www.tizag.com/javascriptT/javascriptconfirm.php
function confirmation() {
var answer = confirm("Are you sure you want to erase ALL data you entered into the fields on this page? Action cannot be undone.")
if (answer){
onclick="clearData()";
}
else{
onclick="close()";
}
}
</script>
However, the
onclick="clearData()";
is not firing, but the
onclick="close()";
works fine, dismissing the dialog box.
How do I incorporate the clearData so it works?
Thanks!