View Full Version : If Javascript is disabled would a form get submitted?

07-12-2011, 08:23 PM
Wasnt sure if I should post this in the JS or HTML forum.

I am relatively new to web programming (1.5 years) and this question just occurred to me.

I use jquery form validation to validate forms on my site. If my browser has javascript disabled, what is stopping someone from submitting crap through my form?

I tried disabling javascript and submitting a form on my site and it posted.

Is there a way to make it so if the user does not have javascript enabled the form cannot post?

07-12-2011, 08:28 PM
Rule number one in form development: Always implement server-side validation, never rely on JavaScript. As you correctly see, with JS disabled you can post any crap if a server side script (PHP/ASP/JSP/CF/…) doesn’t check the input on submit. JavaScript validation is only meant to enhance the usability, not as only method to check form input.