Results 1 to 8 of 8
- 02-22-2010, 02:51 AM #1
Member
- Join Date
- Feb 2010
- Location
- Philippines
- Posts
- 20
- Rep Power
- 0
- 02-22-2010, 12:19 PM #2
Member
- Join Date
- Jan 2009
- Posts
- 14
- Rep Power
- 0
The jave script will be executed at client side without going to server for validation and it is faster which saves the user time. So with javascript you can have fast validation and users can correct immediately. If you have lot of fields and complex validation and if your javascript code increases there will be delay in form loading and response.
If you have a validation with database tables then you must connect to database so at that time your validation can be java classes. The java classes validation will be executed at server side fastly and user form code will be reduced. If you have very complex validation of files also then only you should go for classes.
So based on your requirement you can have javascript at client side prefarable.
- 02-22-2010, 12:27 PM #3
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
Never assume that client side validations will work even if you have them.
Always have server side validations. Client side validations are just to give users quick feedback.
- 02-23-2010, 04:46 AM #4
Member
- Join Date
- Feb 2010
- Location
- Philippines
- Posts
- 20
- Rep Power
- 0
@r035198x sir you mean that i should not use java scripts as my validation and rather use java classes to be safe? or you can have your java scripts then if not work it will be catched by the javal class validations? how can i do this?
- 02-23-2010, 05:12 AM #5
Senior Member
- Join Date
- Mar 2009
- Location
- USA
- Posts
- 127
- Rep Power
- 0
If it is form validation only, why not java script? even validation framework in struts uses javascript. But javascript provides you only form client side validation which is manily to check the users' input. For something like username cannot be less than 6 characters, there is no need to send data to the server and validate. It is just waste of time. Server side validation is usually done for authentication purposes. Both validations are important but if it is only form validation, why not JavaScript?
- 02-23-2010, 05:36 AM #6
Member
- Join Date
- Feb 2010
- Location
- Philippines
- Posts
- 20
- Rep Power
- 0
ic so can i expect that javascript validation will work on every client that will be using it? what about sir r035198x reply that js will not work all the time for every client
- 02-23-2010, 06:03 AM #7
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
Read my reply again and don't confuse Javascripts with Java scripts. Java runs on the server. Javascript runs on the client browser.
You must always have server side validations.
You can have client side validations too to make the users' lives easier.
Javascript can be turned off by users on their browsers meaning that your validations don't run. This will result in a very unfortunate situation for your data. Your data may also be manipulated through other clients (that are not browsers) and you can't guarantee that everyone who writes a client to use your data will always validate correctly.
Always have server side validations.
- 02-23-2010, 07:41 AM #8
Member
- Join Date
- Feb 2010
- Location
- Philippines
- Posts
- 20
- Rep Power
- 0
Similar Threads
-
use Servlet submit the form to receive a form for the Chinese but it shows the garble
By dmt198704 in forum Java ServletReplies: 0Last Post: 10-31-2009, 09:24 AM -
Java Form Validation
By Lovie in forum Java ServletReplies: 7Last Post: 09-22-2009, 05:52 PM -
Form Validation Design
By Algatron in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 03-21-2009, 10:30 PM -
Form validation in struts
By rekha in forum Web FrameworksReplies: 2Last Post: 03-19-2009, 08:55 AM -
form validation
By abhiN in forum New To JavaReplies: 0Last Post: 03-07-2008, 07:04 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks