Greetings. This post is related to my recent post, and
may better explain what I am trying to do .... hopefully :-
)
Question, what is the most efficient way to validate data
in a form? For instance, I know I can do something like
this:
Function Form1_onSubmit()
If Form1.txtuser1.Value = "" Then
' do something here
End If
If Form1.txtuser2.Value = "" Then
' do something here
End If
End Function
However, what if I have several like fields, e.g.
txtuser1, txtuser2, txtuser3, etc. ... in that case the
above approach to data validation is not very efficient.
Especially when I want to run several like fields against
the same validation methods (i.e. is it blank, does it or
does it not contain this or that character?). To further
complicate matters, what if the amount of like fields I
have on my page will vary on each load because they are
created "dynamically" thru ASP code? In that case, there
is no way to setup the above, functional albeit
inefficient, method of validating my data. In a nutshell,
what I am trying to accomplish on the client-side is what
I can rather easily do on the server-side:
For x = 1 To Request.Form.count()
strFrmKey = Request.Form.key(x)
strFrmItm = Request.Form.item(x)
' Do whatever other checking I would like here
Next
Is there, or what is an equivalent for client-side
validation? Any and all answers are greatly appreciated.
Doug