4

I am using jquery validation plugin for validation empty forms. Should I also check this in PHP to be sure on 100%? Or it is ok with javascript validation. Thanks

1
  • You should always have server side validation. As for tools, there are tons of JQuery tools for Form Validation. Just do a google search. Commented Aug 30, 2010 at 17:01

3 Answers 3

8

You should always do your validation on the server.

What happens if a user submits the form in some way not using Javascript? Then all of the JS validation is null and void. Never trust Javascript alone. It's a very nice tool to use to make the site look slick, etc, but you can't assume the user will use it, even if you set it up that you aren't letting them submit normally.


When I personally put client and server side validation up, I work them to be the exact same validations. That way, the user typically doesn't see the server validation, but if something goes wrong, the information is still validated a much as necessary.

Sign up to request clarification or add additional context in comments.

Comments

1

Users can disable javascript wich would bypass all your checking. For this reason you should always check input with php. Validating with javascript is mostly to make use of fancy ajax and jquery visuals. The real validation is always serverside.

Comments

1

javascript is executed by the client, so it is easily fooled. ALWAYS use server side validation as well.

1 Comment

Also, server-side validation should come first, client-side later. It follows progressive enhancement, too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.