Current section: Forms 59 exercises
solution

Form Action

Loading solution

Transcript

00:00 Let's come over here to our form and add a prop called action that is set to API onboarding. If we save this now and I type in a username, submit that, then that's going to send us over to the API onboarding. And it's going to serialize the form in the URL here.

00:16 And our back end API thing just sends back an HTML document that has all the serialized values. So we can take a look at that. So there you go. That's really it. The action determines the route where this will appear.

00:32 And of course, you can make this a non-relative or absolute path. So we could say app playground slash API slash onboarding. And this will work exactly the same. And so yeah, we're just doing a relative here so that we don't have to worry about adding

00:52 the app playground nonsense. But in any case, that is how you add or configure the URL that you want this request to be sent to when the user submits the form.