DEV Community

Discussion on: Form input validation WITHOUT JavaScript

Collapse
 
sem1colons profile image
Youssef Abdulaziz

But is it usable in real product ? I mean I could just inspect it , change the pattern to whatever and submit my arbitrary input right?

Collapse
 
joelbonetr profile image
JoelBonetR 🥇 • Edited

Yes sure!
The same way you can disable JS in your browser, send a request using Postman directly to the endpoint or anything else.

Client code is loaded and running inside third party machines, hence you can't rely in frontend validations in any app. You'll need to re-validate the whole in backend anyway.

Validations in the frontend have 2 purposes:

  1. Give feedback to the user as soon as possible.
  2. Avoid requests to your server if the data that the user is about to send is not valid.

So yes, it's usable in a real product. If you do that and submit wrong data, the backend will throw an error about that and we should be good 😂

Collapse
 
sem1colons profile image
Youssef Abdulaziz

Wow, listening to experience is far more useful than to my rookie mind 😂😂😂...thanks very much.

Thread Thread
 
joelbonetr profile image
JoelBonetR 🥇

😂 No problem, we all have to walk -almost- the same road! 😁