Stopped upgrade form from submitting on enter
This commit is contained in:
parent
b38b10ba83
commit
32d29b0209
2 changed files with 13 additions and 1 deletions
|
|
@ -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()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -3,10 +3,11 @@ defmodule Pinchflat.UpgradeButtonLive do
|
|||
|
||||
def render(assigns) do
|
||||
~H"""
|
||||
<form phx-change="check_matching_text">
|
||||
<form id="upgradeForm" phx-change="check_matching_text" phx-hook="supressEnterSubmission">
|
||||
<.input type="text" name="unlock-pro-textbox" value="" />
|
||||
</form>
|
||||
|
||||
<%!-- The setTimeout is so the modal has time to disappear before it's removed --%>
|
||||
<.button
|
||||
class="w-full mt-4"
|
||||
type="button"
|
||||
|
|
|
|||
Loading…
Reference in a new issue