Hello.
I am doing some form validation and I am having a problem.
I want the code to check for an empty text box and if the box is empty, then display a message above it in the form. Only files that were left blank will have error messages above them.
I am able to do it for ONE field, but if I sting multiple if..then statements together, it does not act like I would want. Rather, it steps through and does not flag all the blank fields..
I am very newbie, but I have made some big strides when it comes to syntax.. Unfortunately, I am unable to find a smart way to do this error thing I am trying to do.
The code shows a working example with The "FirstName" field acting how I'd want it. That's as far as I can get.. I can't seem to get it to check all the variables for NULL (""
and then report the status by modifying the Error String variables I made (strE1, strE2, etc..).
Any and all help is appreciated.. Thanks!
Here's my code for it:
' Create Variables for the form elements
Dim strFirstName, strLastname, strEMailAddress
Dim bitSubscribe, strUsername, strPassword
Dim strE1, strE2, strE3, strE4, strE5, strE6 ' Error Strings for each field
' Assign form values to the variables
strFirstName= Request.Form("FirstName"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
strLastname= Request.Form("LastName"
strEMailAddress= Request.Form("EMailAddress"
bitSubscribe= Request.Form("btnSubscribe"
strUsername= Request.Form("Username"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
strPassword= Request.Form("Password"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
If strFirstName = "" then
strE1 = "First name is required"
Else
strE1 =""
End if
%>
I then use Response.Write to print the error message in the form above the textbox. If the error variable is blank (strE1=""
then no message shows up.
I just can't do it for all the variables.
Yet..
I am doing some form validation and I am having a problem.
I want the code to check for an empty text box and if the box is empty, then display a message above it in the form. Only files that were left blank will have error messages above them.
I am able to do it for ONE field, but if I sting multiple if..then statements together, it does not act like I would want. Rather, it steps through and does not flag all the blank fields..
I am very newbie, but I have made some big strides when it comes to syntax.. Unfortunately, I am unable to find a smart way to do this error thing I am trying to do.
The code shows a working example with The "FirstName" field acting how I'd want it. That's as far as I can get.. I can't seem to get it to check all the variables for NULL (""
Any and all help is appreciated.. Thanks!
Here's my code for it:
' Create Variables for the form elements
Dim strFirstName, strLastname, strEMailAddress
Dim bitSubscribe, strUsername, strPassword
Dim strE1, strE2, strE3, strE4, strE5, strE6 ' Error Strings for each field
' Assign form values to the variables
strFirstName= Request.Form("FirstName"
strLastname= Request.Form("LastName"
strEMailAddress= Request.Form("EMailAddress"
bitSubscribe= Request.Form("btnSubscribe"
strUsername= Request.Form("Username"
strPassword= Request.Form("Password"
If strFirstName = "" then
strE1 = "First name is required"
Else
strE1 =""
End if
%>
I then use Response.Write to print the error message in the form above the textbox. If the error variable is blank (strE1=""
I just can't do it for all the variables.
Yet..