Design comparison
Solution retrospective
I used just html for the form validation since its already integrated. I didn't see any particular benefit on doing it through javascript, maybe someone can clarify that for me? What's the point on validating through js if it can be done with html and the browser?
Community feedback
- @victorsonetPosted over 2 years ago
Hey, The reason you want to use JS instead of HTML is because with JS you can make certain user limitations, for example not letting submit the page when certain inputs are empty or only allowing passwords that have one uppercase letter and 8 letters long etc. Normally without JS (which works on the client side) validation the user data goes instantly to the server and that will do the validation which takes longer time then doing it on the client side, where you instantly get the feedback and you don't make extra work for the server either. I hope this answered your question!
Marked as helpful1@scoltelli27Posted over 2 years ago@victorsonet Thank you so much for the answer! I get it now!
1 - @KaustubhMaladkarPosted almost 2 years ago
Hi. JS is used for form validation because of the flexibility and customisations it provides. But, the most important reason is cyber security. HTML code can easily be changed by just changing the code using the inspector. This is not true for javascript. Sending corrupted files to the server can be extremely dangerous. Hope you found this helpful!
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