Intro component solution. Mobile-first, JS, Flex, fun submit message!
Design comparison
Solution retrospective
Check out my fun form submit design This challenge made me have to flex my JS knowledge a bit more. If you could please check out my JavaScript and give me constructive feedback. I know I repeated myself a lot and I am sure there are ways I could have reduced the amount of code and still get to the same solution.
Community feedback
- @ApplePieGiraffePosted over 3 years ago
Hello there, Eric Salvi! π
Just wanted to sayβthat's a wicked awesome success message! π Nice job on this challenge! π The form validation works pretty well and the extra touch you added is pretty cool! π
I haven't done much form validation from scratch before, but I've often seen code that stores the error messages for a form in an object and then only displays them if there is an error message in the object that corresponds to an input element. It keeps all the error messages in one place and might help you optimize your code a bit. Just a tip! π
Keep coding (and happy coding, too)! π
2@ericsalviPosted over 3 years ago@ApplePieGiraffe I see what you did there! π
Thank you so much for the tip and I'll have to check it out. Do you typically use a validation library for your forms or just never really had the opportunity to do validation from scratch?
I do like the object idea and will keep this on the front of my mind with the next challenge that has a multiple input form with needed validation.
1@ApplePieGiraffePosted over 3 years ago@ericsalvi
Sure thing! π I usually use a validation library for forms (which is why I haven't really done it from scratch yet), but I hope to give it a shot sometime soon! π
1 - @mattstuddertPosted over 3 years ago
Very nice work on this challenge, Eric! Nice to see you adding the extra detail with the confirmation message when you submit the form! π
To help screen reader users if any form fields are invalid, I'd recommend adding
aria-live="polite"
attributes to your error message elements. This will ensure the content of those elements is read out if it is updated to include an error message.Keep up the great work!
1@ericsalviPosted over 3 years ago@mattstuddert I just remembered to implement this suggestion. Just did. Do you mind checking it out to make sure this is what you had suggested?
0 - @renzo4webPosted over 3 years ago
Very good solution congratulations, well done adding a feedback when the form has been sent.
1
Please log in to post a comment
Log in with GitHubJoin 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