From 4ba20e16ecbf993cce1150fecec87c2b9fe4d5b6 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 3 Nov 2023 13:42:21 -0400 Subject: [PATCH] index.html.in: also validate the origin/destination when the page loads Firefox (at least) retains your origin/destination selections when the page reloads, so if we don't validate those choices at page load, it's possible to "skip" validation of an invalid pair by submitting the form right after a reload. --- index.html.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.html.in b/index.html.in index 8529b35..ac8b2be 100644 --- a/index.html.in +++ b/index.html.in @@ -889,6 +889,10 @@ document.getElementsByName("destination").forEach( (x) => x.addEventListener("change", validate_origin_destination) ); + + /* Also do it when the page loads, because firefox likes to + * remember your selection even after the page reloads. */ + window.addEventListener("load", validate_origin_destination); } -- 2.44.2