aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes [Solved] Tradeoff between JavaScript Validation and Other Framework's Validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "[Solved] Tradeoff between JavaScript Validation and Other Framework Watch "[Solved] Tradeoff between JavaScript Validation and Other Framework New topic
Author

[Solved] Tradeoff between JavaScript Validation and Other Framework's Validation

Vikas Kapoor
Ranch Hand

Joined: Aug 16, 2007
Posts: 1374
I am developing a website and right now i am working on login and registration module.I am using spring framework. It has its own validation framework.But i want to use javascript validation. I have following argue to boost my point.

1) Using Spring Valiadtion means server side validation i.e. trip to server. Using JavaScript validation means Client Side validation.i.e. NO trip to server.Hence it improves the performance.

Now, we can think that if somebody disable the browser's Javascript then what,
1) During page rendering we can check if the Javascript is enabled or not . OR
2) We can implement form submission using Javascript only. So if it is disabled, user won't be able to submit the page.

Yes,for above two optoins we can ask the user to enable the JavaScript option and user should be aware of that.If not,user may leave your site PERMANENTLY. So this goes against JavaScript.

So I am confused about this. Which option should I choose?
[ December 06, 2008: Message edited by: Vishal Pandya ]
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

You should ALWAYS ALWAYS ALWAYS do server side validation. NO MATTER WHAT make sure the data that gets sent to the server is what you expect. Client side validation is nice for those that have javascript enabled but it should never be one or the other.


GenRocket - Experts at Building Test Data
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61421
    
  67

Originally posted by Gregg Bolinger:
You should ALWAYS ALWAYS ALWAYS do server side validation.

Just to make sure this doesn't get missed, I'll repeat it a few times:

You should ALWAYS ALWAYS ALWAYS do server side validation.

You should ALWAYS ALWAYS ALWAYS do server side validation.

You should ALWAYS ALWAYS ALWAYS do server side validation.

You should ALWAYS ALWAYS ALWAYS do server side validation.

You should ALWAYS ALWAYS ALWAYS do server side validation.

You should ALWAYS ALWAYS ALWAYS do server side validation.

You should ALWAYS ALWAYS ALWAYS do server side validation.

You should ALWAYS ALWAYS ALWAYS do server side validation.

You should ALWAYS ALWAYS ALWAYS do server side validation.

You should ALWAYS ALWAYS ALWAYS do server side validation.

You should ALWAYS ALWAYS ALWAYS do server side validation.

[ December 06, 2008: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Vikas Kapoor
Ranch Hand

Joined: Aug 16, 2007
Posts: 1374
Oh! it seems you both are totally devoted and convinced to use server side validation but just to convince myself, I repeat we must use server side validation because browser's JavaScript may be disabled.
Am I Right?
[ December 06, 2008: Message edited by: Vishal Pandya ]
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Originally posted by Vishal Pandya:
Oh! it seems you both are totally devoted and convinced to use server side validation but just to convince myself, I repeat we must use server side validation because browser's JavaScript may be disabled.
Am I Right?

[ December 06, 2008: Message edited by: Vishal Pandya ]


Yes PLUS the fact that client side code can be spoofed, hacked, compromised. Never trust data coming from the client no matter what. JavaScript validation is a nice feature, but that is it.
 
jQuery in Action, 2nd edition
 
subject: [Solved] Tradeoff between JavaScript Validation and Other Framework's Validation