Responsive Contact Form with HTML, Javascript & CSS Validation

Solution retrospective
I'm most proud of mastering the use of CSS selectors to dynamically change the layout based on form validation states (:valid, :invalid, and :focus) and leveraging CSS Grid to create a responsive design that adapts seamlessly to different screen widths. In the future, I aim to refine my coding skills by writing more concise and efficient code, while also focusing on creating visually appealing and user-friendly layouts.
What challenges did you encounter, and how did you overcome them?One of the primary challenges I faced was implementing form validation using CSS selectors (:valid, :invalid) without displaying error messages until the user submits the form. This required careful planning and execution to ensure that the design remained error-free until the form was submitted.
To overcome this challenge, I employed a strategic approach. I used JavaScript to apply CSS classes to the form elements after the user submits the form for the first time. This allowed me to leverage the CSS selectors to dynamically change the layout and display error messages only after the form has been submitted. By doing so, I was able to achieve the desired form validation functionality without displaying error messages prematurely.
Please log in to post a comment
Log in with GitHubCommunity feedback
No feedback yet. Be the first to give feedback on George Panagiotinos's solution.
Join our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord