my dog learned polymorphism*
The moose likes HTML, CSS and JavaScript and the fly likes Have a question about turn off javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Have a question about turn off javascript" Watch "Have a question about turn off javascript" New topic
Author

Have a question about turn off javascript

chang Anne
Greenhorn

Joined: Jul 02, 2003
Posts: 29
Hello,
If someone turn off the javascript, the validation of form doesn't work.
How should you do?
Thanks.
Mani Ram
Ranch Hand

Joined: Mar 11, 2002
Posts: 1140
Perform the validations on the server side.


Mani
Quaerendo Invenietis
chang Anne
Greenhorn

Joined: Jul 02, 2003
Posts: 29
Hello,
So Server side do the double-check of forms.
Do you use the double-check in server side?
Thank your opinion.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Server sde validaion is the only way to check forms 100%.
There is a few ways to do it. Either double check with your server side code every time or set a javascript variable in a field that tells it to skip the process on server side. Or just forget about the JavaScript check and just use server side.
A small precentage of people have a fear that JavaScript is evil and it is rather harmless compared to server side languages. My 2 Cents
Eric
sunitha reghu
Ranch Hand

Joined: Dec 12, 2002
Posts: 937
I agree with Eric, small percentage feel that Javascript is evil.
First check whether Js is disabled if yes, redirect them to another page where u have server side validation.
Or give the users a message saying JS is disabled and u need to enable it using NOSCRIPT tag.
Everything has disadvanatages and advantages.
Server side validation means extra load on server and user frst have to submit the page first in order to get validated.
sunitha
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

When do we go for server side validation?
Is it when we need to support different browsers, javascript switched off cases ? Is there any other reasons ?


Groovy
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61103
    
  66

When do we go for server side validation?

Always!
It is never safe to assume that client-side validation has occurred. Not only is it possible that the user might have turned off Javascript, but the malicious user can easily take a look at your source, and mock up his own fake form or URL to submit to your app.
In all my web apps I look upon client-side validation as a 'user experience' enhancement. Functionally, my server-side code makes no assumptions about what is submitted and performs full server-side validation on the data.
hth,
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

What about the round trip time if the user makes some mistake.
Consider a form where there are many fields. I had worked in a project where there lot of fields and was not possible to spilt the form. How should such cases be handled?
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

One more question- "Is it okay to have an web app wher some pages uses client side validation and others use server side validation ?. "
I feel that user may not like this. Any comments?
sunitha reghu
Ranch Hand

Joined: Dec 12, 2002
Posts: 937
Originally posted by Pradeep Bhat:
One more question- "Is it okay to have an web app wher some pages uses client side validation and others use server side validation ?. "
I feel that user may not like this. Any comments?

User may or may not like that. If I am developing a web app fro my own use i have the choice whether to go server side validation or client side validation but most of the cases developer doesnt have the choice of that. ( that is what i experienced). Another issue is with Javascript is suppose ur application is that u have users that use speech browsers ezp some old speech browsers then they will have a problem with reading validation messages and if u developing an web app which need to conform to section 508, then its better not to user Javascript validation.
coz it says that
" When pages utilize scripting languages to display content, or to create interface elements, the information provided by the script shall be identified with functional text that can be read by assistive technology"

It all depends the users you targeting in ur web app
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61103
    
  66

What about the round trip time if the user makes some mistake.

That's the 'user experience' part. It's nice to have client-side validation so that the user gets an error notification at the earliest possible time. But I think it's a grave mistake to assume that client-side validation makes it safe to ignore server-side validation.
"Is it okay to have an web app wher some pages uses client side validation and others use server side validation ?. "

As long as you never assume that client-side validation ensures that the data is good when it gets to the server, you can make such decisions based upon what makes the most sense for your app and your user base.
hth,
bear
chang Anne
Greenhorn

Joined: Jul 02, 2003
Posts: 29
As sunitha raghu mention above,

Or give the users a message saying JS is disabled and u need to enable it using NOSCRIPT tag.

How to do it?
Could you give me some examples?
I am really appreciate it.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
google it and you get this as the first......
http://www.w3schools.com/tags/tag_noscript.asp
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Have a question about turn off javascript