views/honkform.html (view raw)
1<p>
2<button onclick="showhonkform(); return false"><a href="/newhonk">it's honking time</a></button>
3<form id="honkform" action="/honk" method="POST" enctype="multipart/form-data" style="display: none">
4<p></p>
5<input type="hidden" name="rid" value="">
6<input type="hidden" name="CSRF" value="{{ .HonkCSRF }}">
7<textarea name="noise" id="honknoise"></textarea>
8<p>
9<input type="submit" value="it's gonna be honked">
10<label id="donker" style="margin-left:4em;">attach: <input onchange="updatedonker();" type="file" name="donk"><span></span></label>
11</form>
12<script>
13function showhonkform(rid, hname) {
14 var el = document.getElementById("honkform")
15 el.style = "display: block"
16 if (rid) {
17 el.children[0].innerHTML = "tonking " + rid
18 el.children[1].value = rid
19 el.children[3].value = "@" + hname
20 } else {
21 el.children[0].innerHTML = ""
22 el.children[1].value = ""
23 }
24 el.scrollIntoView()
25}
26function updatedonker() {
27 var el = document.getElementById("donker")
28 el.children[1].textContent = el.children[0].value
29}
30</script>