validating data in client side
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?
[306 byte] By [
natoskiiia] at [2007-11-27 11:19:38]

# 1
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
# 2
You should do the Javascript validation because the user will get a quicker response in the case of erroneous input. You should do the server-side validation too, in case the user has Javascript turned off or isn't using a browser.
# 3
Client side validation is usually a subset of the validation done on the server side (ie, server side duplicates the client side validation, and then some).
I usually only do some basic client side validation such as:
a textfield is null, but shouldn't be
a textfield should be in this format but isn't: mm/dd/yyyy
a textfield should be a number but contains a letter.
If these conditions occur, dont submit the form, pop up a warning dialog box instead.
# 4
Hi all,
Thanks all for your replies it made thing clear for me.
But is there a way I can find out in the server side whether did these fields are validated or not, so that I can save some processing for the controller