From 32d29b020985dc9d0ddf2582c985b6c0eec103b6 Mon Sep 17 00:00:00 2001 From: Kieran Eglin Date: Tue, 16 Apr 2024 17:03:43 -0700 Subject: [PATCH] Stopped upgrade form from submitting on enter --- assets/js/app.js | 11 +++++++++++ .../layouts/partials/upgrade_button_live.ex | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/assets/js/app.js b/assets/js/app.js index f161731..90fa638 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -36,6 +36,17 @@ let liveSocket = new LiveSocket('/live', Socket, { window.Alpine.clone(from, to) } } + }, + hooks: { + supressEnterSubmission: { + mounted() { + this.el.addEventListener('keypress', (event) => { + if (event.key === 'Enter') { + event.preventDefault() + } + }) + } + } } }) diff --git a/lib/pinchflat_web/components/layouts/partials/upgrade_button_live.ex b/lib/pinchflat_web/components/layouts/partials/upgrade_button_live.ex index 959edae..17e1ac2 100644 --- a/lib/pinchflat_web/components/layouts/partials/upgrade_button_live.ex +++ b/lib/pinchflat_web/components/layouts/partials/upgrade_button_live.ex @@ -3,10 +3,11 @@ defmodule Pinchflat.UpgradeButtonLive do def render(assigns) do ~H""" -
+ <.input type="text" name="unlock-pro-textbox" value="" />
+ <%!-- The setTimeout is so the modal has time to disappear before it's removed --%> <.button class="w-full mt-4" type="button"