Stop submit event if prompt cancel is clicked (#495)

This commit is contained in:
Daniel Markstedt 2021-12-02 17:20:00 -08:00 committed by GitHub
parent 267625d1e8
commit df3387b178
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -113,7 +113,7 @@
<input type="submit" value="Info">
</form>
{% else %}
<form action="/scsi/reserve" method="post" onsubmit="var memo = prompt('Enter a memo for this reservation'); document.getElementById('memo_{{ device.id }}').value = memo;">
<form action="/scsi/reserve" method="post" onsubmit="var memo = prompt('Enter a memo for this reservation'); if (memo === null) event.preventDefault(); document.getElementById('memo_{{ device.id }}').value = memo;">
<input name="scsi_id" type="hidden" value="{{ device.id }}">
<input name="memo" id="memo_{{ device.id }}" type="hidden" value="">
<input type="submit" value="Reserve">