Advanced Multi-Step Campaign Configuration Form
As a senior engineer at a leading marketing technology company, you're tasked with enhancing the campaign creation workflow. The current process involves a complex form that is difficult to navigate and prone to errors. Your goal is to build a robust, multi-step form that guides users through campaign configuration, ensuring data integrity and a smooth user experience. This problem is crucial for streamlining our core product and improving user efficiency in launching successful marketing campaigns.
Your primary task is to implement a multi-step form for creating a marketing campaign. This involves:
Multi-Step Structure: Create a form with at least four distinct steps:
campaignName (text) and campaignType (select: 'Display', 'Search', 'Social').targetAudience (text) and platforms (checkboxes: 'Google Ads', 'Facebook Ads', 'Instagram Ads'), geoTargeting (text, optional).budgetAmount (number), startDate (date), and endDate (date).Navigation: Implement "Next" and "Previous" buttons to navigate between steps.
Client-Side Validation: Implement comprehensive validation for each step:
budgetAmount must be a number > 100; endDate must be after startDate.campaignType (from Step 1) is 'Social', then 'Google Ads' should be disabled and unchecked in Step 2, and attempting to select it should show an error.Data Persistence: All entered form data must persist as the user navigates between steps.
Dynamic UI: Implement conditional rendering for specific fields:
budgetAmount exceeds 5000, a new checkbox field budgetApprovalRequired should appear.Submission: On the final "Review & Submit" step, clicking "Submit Campaign" should simulate an API call (e.g., using setTimeout) and display a success or error message.
label for inputs, fieldset/legend for groups) and ensure error messages are associated with their fields (e.g., via aria-describedby if you use a library or manually manage).budgetApprovalRequired checkbox conditionally appears based on the budgetAmount in Step 3.campaignType from Step 1.Constraints
react-router-dom) for individual steps. Internal state management for steps is sufficient.Loading editor...