This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Have a question about turn off javascript

 
chang Anne
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
If someone turn off the javascript, the validation of form doesn't work.
How should you do?
Thanks.
 
Mani Ram
Ranch Hand
Posts: 1140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perform the validations on the server side.
 
chang Anne
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
google it and you get this as the first......
http://www.w3schools.com/tags/tag_noscript.asp
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic