Use one field per receipt.

Add fields with button.
This commit is contained in:
tastytea 2021-01-21 06:49:33 +01:00
parent a0c3df96f3
commit fd1690d45c
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 17 additions and 5 deletions

View File

@ -31,7 +31,7 @@
{
padding: 0;
}
input[type=file], input[list=list_tags]
input[type=file], input[list=list_tags], input[type=url]
{
margin-left: 10ch;
}
@ -209,10 +209,9 @@
<input type="button" id="add_tag" value="" onclick="javascript:add_input_tag();">
<br>
<label for="receipts">Receipts:</label>
<input type="url" id="receipts" name="receipts"
placeholder="https://example.com/@user/1234567890,https://example.com/about/more" required>
<!-- <input type="button" id="add_receipt" value="" disabled> -->
<label for="receipts">Receipts:</label><span class="hint">(One receipt per field or comma separated)</span><br>
<input type="url" id="receipts" name="receipts[]" required>
<input type="button" id="add_receipt" value="" onclick="javascript:add_input_receipt();">
<br>
<label for="screenshot1">Screenshots:</label><span class="hint">(optional)</span>
@ -276,6 +275,19 @@
form.insertBefore(input_text, btn);
input_text.focus();
}
function add_input_receipt()
{
const input_text = document.createElement("input");
input_text.setAttribute("type", "url");
input_text.setAttribute("name", "receipts[]");
const form = document.getElementById("form_add");
const btn = document.getElementById("add_receipt");
form.insertBefore(document.createElement("br"), btn);
form.insertBefore(input_text, btn);
input_text.focus();
}
</script>
<datalist id="list_tags">