Strip off leading query parameter input values to prevent confusion

This commit is contained in:
Jeremy Zhang 2020-03-22 18:06:49 -07:00
parent d5e034a880
commit f820033a8f

View File

@ -8,7 +8,7 @@
for (let i = 0; i < inputs.length; i++) { for (let i = 0; i < inputs.length; i++) {
let input = $(inputs[i]); let input = $(inputs[i]);
let name = input.attr("name"); let name = input.attr("name");
let value = input.val(); let value = input.val().trim();
if (!value) { if (!value) {
continue; continue;
} }
@ -17,6 +17,9 @@
} else { } else {
url += "&"; url += "&";
} }
if (value.startsWith(`${name}=`)) {
value = value.substr(name.length + 1);
}
url += `${name}=${value}`; url += `${name}=${value}`;
} }
$("#queryparam_url").val(url); $("#queryparam_url").val(url);