Enable search form

This commit is contained in:
Yarmo Mackenbach 2021-05-04 10:40:04 +02:00
parent 637a0a5f5c
commit 87c9acfde1
No known key found for this signature in database
GPG key ID: 37367F4AF4087AD1
2 changed files with 10 additions and 1 deletions

View file

@ -115,6 +115,15 @@ const elFormSearch = document.body.querySelector("#search");
if (elFormSearch) {
elFormSearch.onsubmit = function (evt) {
evt.preventDefault();
const protocol = elFormSearch.querySelector("input[type='radio']:checked").value;
const identifier = elFormSearch.querySelector("input[type='search']").value;
if (protocol == 'sig') {
window.location.href = `/${protocol}`;
} else {
window.location.href = `/${protocol}/${encodeURIComponent(identifier)}`;
}
}
const elSearchRadio = elFormSearch.querySelectorAll("input[type='radio']");

View file

@ -14,7 +14,7 @@ block content
#search.form-wrapper.card
h2 Generate a profile
form(action="post")
input(type="search" name="query" placeholder="3637202523e7c1309ab79e99ef2dc5827b445f4b, test@doip.rocks")
input(type="search" name="query" required placeholder="3637202523e7c1309ab79e99ef2dc5827b445f4b, test@doip.rocks")
div.radio-wrapper
input#protocol-hkp(type="radio" name="protocol" value="hkp" checked="true")
label(for="protocol-hkp") HKP