Why most sites rarely use javascript to validate form input?

Javascript coding ..

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 51
Joined: Wed Aug 24, 2005 2:10 am

Tue Sep 05, 2006 9:01 pm

Hi there!

I wonder why most sites rarely use javascript to validate form input. I usually see them validate the input during the server-side process. Are there any reasons that most sites do this? In my site, I usually validate the form input during the client-side process (I mean check the valid email address, empty input, etc. using javascript). Are there any disadvantages if I do it like this?

Hope someone could give me some ideas about this.
Thank in advance.

Makara Kao

User avatar
New php-forum User
New php-forum User
Posts: 140
Joined: Sun May 11, 2008 1:40 am
Location: London, UK

Fri Jun 06, 2008 12:15 am

The vistor may have javascript disabled or a browser which doen't suport javascript. Javascript can be manipulated by anyone with knowledge of how it works.
Different browsers run javascript differently. Some javascript functions in one browser are not their in the other browsers.

The best way it to use both client & server side validation. That way the javascript can try to help the user enter the data correctly the first time but if they don't have javascript then the server will correct it.

When posting code to be reviewed please enclose it in the [ code ] [ /code ] tags as it makes it a lot easier for people to read as it correctly formats itself on screen.

    Click Here to Visit[/url]

    Post Reply