I used jQuery form validation to make sure the data entered by the user are of correct format. However, the user may disable his/her browser's javascript and enters garbage data. How can I solve this problem?
-
Always validate on the server too.James Allardice– James Allardice2013-04-29 07:21:36 +00:00Commented Apr 29, 2013 at 7:21
-
Still people disable javascript in browser?arjuncc– arjuncc2013-04-29 07:22:12 +00:00Commented Apr 29, 2013 at 7:22
-
Use server side validation.John– John2013-04-29 07:22:18 +00:00Commented Apr 29, 2013 at 7:22
-
@arjuncc, I guess they just want to hack into the system.Randy Tang– Randy Tang2013-04-29 11:40:42 +00:00Commented Apr 29, 2013 at 11:40
2 Answers
It is always a good practise to do serverside validation also.Don't depend on client too much.
You SHOULD NOT assume the validation successfully done at client side is 100% perfect. No matter even if it serves less than 50 users. You never know which of your user/emplyee turn into an "evil" and do some harmful activity knowing you dont have proper validations in place.
I recommend you to go through:JavaScript: client-side vs. server-side validation
Comments
If you want to force the user to use JavaScript, you can use
<body>
<noscript>
Javascript is disabled.
<meta HTTP-EQUIV="REFRESH" content="0; url=http://www.yourweb.com/message_page">
</noscript>
</body>
HTML 5 have some validation features, but most of the modern browser doesn't fully support it.
4 Comments
<head> element?