Confirm before deleting a post

This commit is contained in:
Brian Picciano 2023-08-13 21:42:27 +02:00
parent e8a1f51fb6
commit 0bc9cd83b4

View File

@ -1,4 +1,10 @@
{{ define "body" }} {{ define "body" }}
<script>
function confirmDelete(event) {
if (!confirm("Are you sure you want to delete this post?"))
event.preventDefault();
}
</script>
<p> <p>
<a href="{{ BlogURL "admin" }}">Back to Admin</a> <a href="{{ BlogURL "admin" }}">Back to Admin</a>
@ -34,7 +40,11 @@
action="{{ PostURL .ID }}?method=delete" action="{{ PostURL .ID }}?method=delete"
method="POST" method="POST"
> >
<input type="submit" value="Delete" /> <input
type="submit"
value="Delete"
onclick="confirmDelete(event)"
/>
</form> </form>
</td> </td>
</tr> </tr>