Design comparison
Solution retrospective
I'm proud of using a native API for the form validation as it does some heavy lifting.
I also tried to write the html / CSS / JS in a structured / readable / understandable matter.
Next time I'd like to try out form validation using a well known library or framework.
What challenges did you encounter, and how did you overcome them?The main challenge was the form validation. for that I relied on the Constraint Validation Native API.
When the form is submitted we call form.checkValidity()
native method which returns if the form is valid based on the controls attributes / types. and trigger invalid events on any controls that don't pass validation.
We listen for the invalid and change events on the inputs and we call a function that adds the errors indicators based on why the input is invalid or remove them if the input is valid. also relied on the :invalid
pseudo class selector for styling the invalid inputs.
I would like to know if my code is readable and understandable by other developers.
Thank you for viewing my solution!
Community feedback
- @raficode2303Posted 8 months ago
i like the :invalid pseudo class selector for styling the invalid inputs. the native API for the form validation works great but it not good for space characters the solution looks like the design 👏 keep to build 👷
1@ilyesabPosted 8 months agoHi @raficode2303, Thank you! I'll continue trying my best!
0
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