summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2025-09-04 10:40:37 -0400
committerBen Sima (aider) <ben@bsima.me>2025-09-04 10:40:37 -0400
commit7ea6ef1b4ebccedeba52d670565741fb1b3e8202 (patch)
tree7ed1e7a7a0a81eef15d348d73c04d4766c117240
parent576a85843dbd1834a8973aed6145ae0b9ddc1b2b (diff)
Add URL auto-select and clear on successful submit
Improve user experience by automatically selecting the URL input when focused and clearing the input field after a successful submission. This reduces manual interaction and provides clearer feedback on successful form submission.
-rw-r--r--Biz/PodcastItLater/Web.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Biz/PodcastItLater/Web.py b/Biz/PodcastItLater/Web.py
index 3493b7b..8897ce0 100644
--- a/Biz/PodcastItLater/Web.py
+++ b/Biz/PodcastItLater/Web.py
@@ -264,6 +264,7 @@ class SubmitForm(Component[AnyChildren, Attrs]):
"padding": "8px",
"margin": "4px 0",
},
+ on_focus="this.select()",
),
),
html.button(
@@ -280,6 +281,11 @@ class SubmitForm(Component[AnyChildren, Attrs]):
hx_post="/submit",
hx_target="#submit-result",
hx_swap="innerHTML",
+ hx_on=(
+ "htmx:afterRequest: "
+ "if(event.detail.successful) "
+ "document.getElementById('url').value = ''"
+ ),
),
html.div(id="submit-result", style={"margin-top": "10px"}),
)