Hi i need to do some server side validation of a few form fields from request.form. I'm trying to build the statement in an elegant way if the request.form is empty, so i can response write, and split the message back to the user, this is what i have, any help appreciated in making it elegant. Thanks!
Session("mess")=""
Dim item
''' below set array to request.form values
Dim arrChk(6)
arrChk(0)=Trim(strGuestName)
arrChk(1)=Trim(strPhoneNumber)
arrChk(2)=Trim(strCity)
arrChk(3)=Trim(strStateProvince)
arrChk(4)=Trim(strCountry)
arrChk(5)=Trim(strCreditCardNumber)
arrChk(6)=Trim(strCreditCardExpiry)
'' below the message to cancatenate into a string to later
''split for the user to read
Dim arrMess(6)
arrMess(0)="Name is a required field."
arrMess(1)="Phone Number is a required field."
arrMess(2)="City is a required field."
arrMess(3)="State / Province is a required field."
arrMess(4)="Country is a required field."
arrMess(5)="Value Card is a required field."
arrMess(6)="Value Card Date is a required field."
For i=0 to 6
If arrChk(i)="" Then Session("mess") = Session("mess") & "|" & arrMess(i)
Next
If Session("mess")<>"" Then Response.Redirect("page1.asp")
Session("mess")=""
Dim item
''' below set array to request.form values
Dim arrChk(6)
arrChk(0)=Trim(strGuestName)
arrChk(1)=Trim(strPhoneNumber)
arrChk(2)=Trim(strCity)
arrChk(3)=Trim(strStateProvince)
arrChk(4)=Trim(strCountry)
arrChk(5)=Trim(strCreditCardNumber)
arrChk(6)=Trim(strCreditCardExpiry)
'' below the message to cancatenate into a string to later
''split for the user to read
Dim arrMess(6)
arrMess(0)="Name is a required field."
arrMess(1)="Phone Number is a required field."
arrMess(2)="City is a required field."
arrMess(3)="State / Province is a required field."
arrMess(4)="Country is a required field."
arrMess(5)="Value Card is a required field."
arrMess(6)="Value Card Date is a required field."
For i=0 to 6
If arrChk(i)="" Then Session("mess") = Session("mess") & "|" & arrMess(i)
Next
If Session("mess")<>"" Then Response.Redirect("page1.asp")