From 7ea6ef1b4ebccedeba52d670565741fb1b3e8202 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Thu, 4 Sep 2025 10:40:37 -0400 Subject: 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. --- Biz/PodcastItLater/Web.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Biz/PodcastItLater/Web.py') 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"}), ) -- cgit v1.2.3