• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

validating data in client side in a web application

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I'm developing a web application using Struts framework.

and my questions is, does the validate method int the ActionForm replaces the using javascript validation?

If I can do all the validations in this validate method, so does that mean that i'm not going to use JS at all?

For example if I need to check if a field has been entered, or for the field's length
Should I do that using JS validation, or the validate method in form bean.

if they are working the same way, so I guess it would be more efficient to be written in the ActionForm
[ July 22, 2007: Message edited by: Nadine Hossam ]
 
author & internet detective
Posts: 41905
909
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nadine,
You can choose whether to do the validation instead of or in addition to the JavaScript. Many people prefer to have both as users see errors earlier. This is especially useful for required fields. If I leave out a required field, should I have to wait for a server roundtrip to find out?

For field lengths, you can use an HTML attribute to restrict length so the JavaScript is not necessary. Of course there is no harm since Struts can generate the JavaScript validation for you.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic