Note: This challenge focuses more on logic than UI. If you want to also focus on and practice UI, visit our UI Components challenges.
Objective: Implement a multistep form with 3 steps, where users can input data and navigate back and forth between steps.
Instructions:
-
Create a form with at least 3 steps. Each step should contain a set of input fields.
- Step 1: Personal Information (e.g., Name, Email).
- Step 2: Contact Details (e.g., Phone Number, Address).
- Step 3: Review (Display entered information for review before submission).
-
Include "Next" and "Back" buttons to allow users to navigate between the steps.
-
On the final step, provide a "Submit" button that console.logs
or processes the form data.
Requirements:
- Users should be able to move between steps using the "Next" and "Back" buttons.
- The form data should persist as users navigate between steps.
Hints:
- Use an array or object to store the form data and update it as the user progresses through the steps.
Bonus:
- Implement validation for the form fields (e.g., email format, required fields).
- Allow users to directly jump to a specific step if they’ve already visited it.
- Show a summary of all entered information on the final review step before submission.