Form Action
Loading "Form Action"
Run locally for transcripts
π§ββοΈ I've added some backend code that will handle our form submission. It's at
api/onboarding
. You can find it in .Note: the
api.server.ts
file is some magic from the Workshop app to make it
so we can test things out with a backend server without having to actually set
up a backend server. It's not something you'd use in a real app.π¨βπΌ Great! So we want the user's form submission to be sent along to
api/onboarding
. By default, when a form is submitted, the browser will send
the form data to the current page's URL. We can change this by adding an
action
attribute to the form element:<form action="path/to/backend/route">
<!-- ... -->
</form>
Go ahead and add an
action
attribute to the form element.π¦ You may notice a full page refresh when you submit the form. We'll talk
about this in a future step.