honk/views/honkform.html

31 lines
1.0 KiB
HTML
Raw Normal View History

2019-04-09 13:59:33 +02:00
<p>
<button onclick="showhonkform(); return false"><a href="/newhonk">it's honking time</a></button>
<form id="honkform" action="/honk" method="POST" enctype="multipart/form-data" style="display: none">
<p></p>
<input type="hidden" name="rid" value="">
<input type="hidden" name="CSRF" value="{{ .HonkCSRF }}">
<textarea name="noise" id="honknoise"></textarea>
<p>
<input type="submit" value="it's gonna be honked">
<label id="donker" style="margin-left:4em;">attach: <input onchange="updatedonker();" type="file" name="donk"><span></span></label>
</form>
<script>
function showhonkform(rid, hname) {
var el = document.getElementById("honkform")
el.style = "display: block"
if (rid) {
el.children[0].innerHTML = "tonking " + rid
el.children[1].value = rid
2019-04-09 23:44:57 +02:00
el.children[3].value = "@" + hname + " "
2019-04-09 13:59:33 +02:00
} else {
el.children[0].innerHTML = ""
el.children[1].value = ""
}
el.scrollIntoView()
}
function updatedonker() {
var el = document.getElementById("donker")
el.children[1].textContent = el.children[0].value
}
</script>