I have the following template:
<h1>Confirmation instructions</h1>
<button onpress={Routes.phone_confirmation_path(@conn, :create)}>Send Code</button>
<.form id="code-form" let={f} for={:user} action={Routes.phone_confirmation_path(@conn, :update)}>
<div>
<%= label f, :code%>
<%= text_input f, :code, required: true, id: "code" %>
<%= submit "Submit Code"%>
</div>
</.form>
<script>
async function sendCode() {
await fetch('/')
}
</script>
And I want to run the referenced function when the user presses the button outside the form. This current configuration isn’t working, any ideas as to how to achieve this?