I handle the validation with three sub-scripts that are included into
the *.asp page that the first form submits to.
reservationRequestV3_Validation.asp
reservationRequestV3_Processing.asp
reservationRequestV3_InvalidCenter.asp
_Validation.asp obviously handles the validation. I approached the
validation by writing functions to validate the various TYPES of fields
(i.e. all text, phone number, select list, etc.) Then I use an variable
to capture the error returned by the function for the particular field
and if neccessary any applicable text message. The variables are named
(userNameValidationError, responseMethodValidationError,
userPhoneHomeValidationError, userPhoneHomeValidationText, etc.)
If all of the _validationError variables = 0, _Processing is executed to
process the request. '0' assumes that no error occurred.
If one or more of the _validationError variables <> 0, the
_InvalidCenter script executes. This script sends a new form to the
visitor indicating which fields are valid and which are not. If a
particular value is valid, a HIDDEN input is written with the value set
to <%resposne.write request("fieldName")%> to maintain the original
value. The value is then written as text to display it for reference. If
the value is invalid, a form field is written.
if nameValidationError = 0 then
'write a hidden form field with the value set to the NAME
'write the actual value as text so the user can see it
else
'write a form field with the value and highlight the field
'write an error message explaining the problem
end if
The INVALID FORM submits to _Validation.asp to allow the process to
execute again if needed.
I choose to split up the three scripts to make life easier in making
changes and debuggin since if all three were combined the total number
of lines would be horendeous(sp).
David H.
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!