Fixed so that the values of the input fields are trimmed before composing the summary when they are changed.

This commit is contained in:
依瑪貓 2023-03-04 00:09:30 +08:00
parent f6ed6b10a7
commit 73f7d14e7b

View File

@ -462,6 +462,7 @@ class TagTabPlane extends TabPlane {
this.initializeTagButtons();
const tabPlane = this;
this.tag.onchange = function () {
tabPlane.tag.value = tabPlane.tag.value.trim();
let isMatched = false;
for (const tagButton of tabPlane.tagButtons) {
if (tagButton.dataset.value === tabPlane.tag.value) {
@ -692,6 +693,7 @@ class GeneralTripTab extends TagTabPlane {
this.#directionButtons = Array.from(document.getElementsByClassName(this.prefix + "-direction"));
const tabPlane = this;
this.#from.onchange = function () {
tabPlane.#from.value = tabPlane.#from.value.trim();
tabPlane.updateSummary();
tabPlane.validateFrom();
};
@ -707,6 +709,7 @@ class GeneralTripTab extends TagTabPlane {
};
}
this.#to.onchange = function () {
tabPlane.#to.value = tabPlane.#to.value.trim();
tabPlane.updateSummary();
tabPlane.validateTo();
};
@ -900,14 +903,17 @@ class BusTripTab extends TagTabPlane {
this.#toError = document.getElementById(this.prefix + "-to-error")
const tabPlane = this;
this.#route.onchange = function () {
tabPlane.#route.value = tabPlane.#route.value.trim();
tabPlane.updateSummary();
tabPlane.validateRoute();
};
this.#from.onchange = function () {
tabPlane.#from.value = tabPlane.#from.value.trim();
tabPlane.updateSummary();
tabPlane.validateFrom();
};
this.#to.onchange = function () {
tabPlane.#to.value = tabPlane.#to.value.trim();
tabPlane.updateSummary();
tabPlane.validateTo();
};