In this episode, we focus on improving the navigation for our multi-step form. Instead of having the step buttons at the top—which could let users jump forward when they shouldn't—we're disabling those and building a dedicated step navigation component for the bottom of the form. This gives us better control: users won't be able to proceed to the next step unless they submit the current step's form, but they can still go back whenever needed.
We start by editing our top navigation and making sure it's no longer clickable. Then, we create a new bottom navigation component, buttons.blade.php
, which will house our Submit and Back buttons. We go through how to structure this so the submit button is always on the right, and the back button (if available) appears on the left. This layout uses Flexbox for styling, and we add some spacing and borders for a clean look.
Next, we update our form steps to use this new component, passing in the appropriate buttons for each step. You’ll see how to inject a "Back" button only where it makes sense, and wire it up to return to the previous step.
Finally, we run into an interesting issue where going back and forward again creates multiple records, illustrating the challenges of building robust multi-step forms. We wrap up by previewing the next episode, where we’ll address how to prevent unintended submissions in the first step.
This is a practical episode: by the end, you’ll have a reusable component that handles navigation between steps in a user-friendly way!