function createform_OnSubmit() createform_OnSubmit = False Call Check(createform.username.Value,"Please enter a username.") if validation = true then Call Check(createform.first_name.Value,"Please enter a first name.") if validation = true then Call Check(createform.last_name.Value,"Please enter a last name.") if validation = true then Call Check(createform.password.Value,"Please enter a Password.") if validation = true then Call Check(createform.veriPass.Value,"Please enter a second password.") if validation = true then if createform.password.Value <> createform.veriPass.Value then msgbox("Your two passwords do not match, please try again") validation = false end if end if if validation = true then Call Check(createform.phone_no.Value,"Please enter a phone number.") if validation = true then Call CheckPhone(createform.phone_no.Value,"Phone number is incorrect format.") if validation = true then Call Check(createform.email.Value,"Please enter an email address.") if validation = true then call CheckEmail(createform.email.Value,"The email entered is not of the correct format someone@somewhere.suffix. Please try again") if validation = true then createform_OnSubmit = True else createform_OnSubmit = False End if End Function <!--#include file="validation.inc"--> </script> </head> <body> <!--#include file="connect.inc"--> <table> <tr><th colspan="3">Fields marked with a <font color="#FF0000" size="4"><b>*</b></font> are compulsory</th></tr> <form name="createform" method="post" action="response.asp"> <% set rsTbl = Server.CreateObject("ADODB.Recordset") rsTbl.open "SELECT * FROM Users", conn, 1, 3 For each strField in rsTbl.Fields strFieldN = strField.Name strFieldN = ucase(left(strFieldN,1)) & mid(strFieldN, 2, len(strFieldN)) intMark = inStr(strFieldN,"_") if intMark > 1 then strleft = mid(strFieldN, 1, intMark-1) & " " strRight = ucase(left(mid(strFieldN, intMark+1, len(strFieldN)-intMark),1)) & mid(strFieldN, intMark+2, len(strFieldN)) strFieldN = strLeft & strRight end if if strField.name <> "club_name" AND strField.name <> "approved" AND strField.name <> _ "warning" AND strField.name <> "level" AND strField.name <> "allow_login" AND _ strField.name <> "post_approved" AND strField.name <> "status" AND strField.name <> _ "attempts" AND strField.name <> "password" AND strField.name <> "available" AND _ strField.name <> "player_id" AND strField.Name <> "position" AND strField.Name <> _ "manager" AND strField.Name <> "fixture_id" AND strField.Name <> "home_team" AND _ strField.Name <> "away_team" AND strField.Name <> "venue" then if strField.Name="username" OR strField.Name="email" OR strField.Name="first_name" OR _ strField.Name="last_name" OR strField.Name="home_colours" OR strField.Name="away_colours" OR _ strField.Name="date" OR strField.Name = "time" OR strField.Name = "phone_no" then response.write "<tr><th>" & strFieldN & ":</th><td><input type='text' name='" & strField.Name & "' /></td><td><font color='#FF0000' size='4'><b>*</b></font></td></tr>" else response.write "<tr><th>" & strFieldN & ":</th><td><input type='text' name='" & strField.Name & "' /></td></tr>" end if elseif strField.name = "club_name" OR strField.name = "home_team" OR _ strField.name = "away_team" then if strFunc <> "club" then response.write "<tr><th>" & strFieldN & ":</th><td><Select name='" & strField.Name & "'>" set rsClub = Server.CreateObject("ADODB.Recordset") rsClub.open "SELECT club_name FROM club ORDER BY club_name", conn, 1, 3 DO UNTIL rsClub.eof club_name = rsClub("club_name") intMark = inStr(club_name," ") if intMark > 1 then strleft = mid(club_name, 1, intMark-1) & "_" strRight = mid(club_name, intMark+1, len(club_name)) club_name = strLeft & strRight end if response.write "<OPTION value=" & club_name & ">" & rsClub("club_name") & "</OPTION>" rsClub.MOVENEXT LOOP response.write "</SELECT></td><td><font color='#FF0000' size='4'><b>*</b></font></td></tr>" rsClub.Close else response.write "<tr><th>" & strFieldN & ":</th><td><input type='text' name='" & strField.Name & "' /></td><td><font color='#FF0000' size='4'><b>*</b></font></td></tr>" end if elseif strField.name = "password" then response.write "<tr><th>Password:</th><td><input type='password' name='" & strField.Name & "' /></td><td><font color='#FF0000' size='4'><b>*</b></font></td></tr>" response.write "<tr><th>Retype Password:</th><td><input type='password' name='veriPass' /></td><td><font color='#FF0000' size='4'><b>*</b></font></td></tr>" elseif strField.name = "manager" OR strField.name = "available" then response.write "<tr><th>" & strFieldN & "</th><td><input type='checkbox' name='" & strField.name & "' /></td></tr>" elseif strField.name = "venue" then response.write "<tr><th>" & strFieldN & ":</th><td><Select name='" & strField.Name & "'>" for x = 1 to 6 response.write "<OPTION value='pitch" & x & "'>Pitch " & x & "</OPTION>" next response.write "</select></td></tr>" elseif strField.name = "position" then response.write "<tr><th>" & strFieldN & ":</th><td><Select name='" & strField.Name & "'>" response.write "<option value='Goalkeeper'>Goalkeeper</option>" response.write "<option value='Defender'>Defender</option>" response.write "<option value='Midfielder'>Midfielder</option>" response.write "<option value='Striker'>Striker</option>" response.write "</select></td></tr>" end if Next set rsTbl = nothing set conn = nothing response.wri
function createform_OnSubmit() createform_OnSubmit = False Call Check(createform.username.Value,"Please enter a username.") if validation = true then Call Check(createform.first_name.Value,"Please enter a first name.") if validation = true then Call Check(createform.last_name.Value,"Please enter a last name.") if validation = true then Call Check(createform.password.Value,"Please enter a Password.") if validation = true then Call Check(createform.veriPass.Value,"Please enter a second password.") if validation = true then if createform.password.Value <> createform.veriPass.Value then msgbox("Your two passwords do not match, please try again") validation = false end if end if if validation = true then Call Check(createform.phone_no.Value,"Please enter a phone number.") if validation = true then Call CheckPhone(createform.phone_no.Value,"Phone number is incorrect format.") if validation = true then Call Check(createform.email.Value,"Please enter an email address.") if validation = true then call CheckEmail(createform.email.Value,"The email entered is not of the correct format someone@somewhere.suffix. Please try again") if validation = true then createform_OnSubmit = True else createform_OnSubmit = False End if End Function <!--#include file="validation.inc"--> </script> </head> <body> <!--#include file="connect.inc"--> <table> <tr><th colspan="3">Fields marked with a <font color="#FF0000" size="4"><b>*</b></font> are compulsory</th></tr> <form name="createform" method="post" action="response.asp"> <% set rsTbl = Server.CreateObject("ADODB.Recordset") rsTbl.open "SELECT * FROM Users", conn, 1, 3 For each strField in rsTbl.Fields strFieldN = strField.Name strFieldN = ucase(left(strFieldN,1)) & mid(strFieldN, 2, len(strFieldN)) intMark = inStr(strFieldN,"_") if intMark > 1 then strleft = mid(strFieldN, 1, intMark-1) & " " strRight = ucase(left(mid(strFieldN, intMark+1, len(strFieldN)-intMark),1)) & mid(strFieldN, intMark+2, len(strFieldN)) strFieldN = strLeft & strRight end if if strField.name <> "club_name" AND strField.name <> "approved" AND strField.name <> _ "warning" AND strField.name <> "level" AND strField.name <> "allow_login" AND _ strField.name <> "post_approved" AND strField.name <> "status" AND strField.name <> _ "attempts" AND strField.name <> "password" AND strField.name <> "available" AND _ strField.name <> "player_id" AND strField.Name <> "position" AND strField.Name <> _ "manager" AND strField.Name <> "fixture_id" AND strField.Name <> "home_team" AND _ strField.Name <> "away_team" AND strField.Name <> "venue" then if strField.Name="username" OR strField.Name="email" OR strField.Name="first_name" OR _ strField.Name="last_name" OR strField.Name="home_colours" OR strField.Name="away_colours" OR _ strField.Name="date" OR strField.Name = "time" OR strField.Name = "phone_no" then response.write "<tr><th>" & strFieldN & ":</th><td><input type='text' name='" & strField.Name & "' /></td><td><font color='#FF0000' size='4'><b>*</b></font></td></tr>" else response.write "<tr><th>" & strFieldN & ":</th><td><input type='text' name='" & strField.Name & "' /></td></tr>" end if elseif strField.name = "club_name" OR strField.name = "home_team" OR _ strField.name = "away_team" then if strFunc <> "club" then response.write "<tr><th>" & strFieldN & ":</th><td><Select name='" & strField.Name & "'>" set rsClub = Server.CreateObject("ADODB.Recordset") rsClub.open "SELECT club_name FROM club ORDER BY club_name", conn, 1, 3 DO UNTIL rsClub.eof club_name = rsClub("club_name") intMark = inStr(club_name," ") if intMark > 1 then strleft = mid(club_name, 1, intMark-1) & "_" strRight = mid(club_name, intMark+1, len(club_name)) club_name = strLeft & strRight end if response.write "<OPTION value=" & club_name & ">" & rsClub("club_name") & "</OPTION>" rsClub.MOVENEXT LOOP response.write "</SELECT></td><td><font color='#FF0000' size='4'><b>*</b></font></td></tr>" rsClub.Close else response.write "<tr><th>" & strFieldN & ":</th><td><input type='text' name='" & strField.Name & "' /></td><td><font color='#FF0000' size='4'><b>*</b></font></td></tr>" end if elseif strField.name = "password" then response.write "<tr><th>Password:</th><td><input type='password' name='" & strField.Name & "' /></td><td><font color='#FF0000' size='4'><b>*</b></font></td></tr>" response.write "<tr><th>Retype Password:</th><td><input type='password' name='veriPass' /></td><td><font color='#FF0000' size='4'><b>*</b></font></td></tr>" elseif strField.name = "manager" OR strField.name = "available" then response.write "<tr><th>" & strFieldN & "</th><td><input type='checkbox' name='" & strField.name & "' /></td></tr>" elseif strField.name = "venue" then response.write "<tr><th>" & strFieldN & ":</th><td><Select name='" & strField.Name & "'>" for x = 1 to 6 response.write "<OPTION value='pitch" & x & "'>Pitch " & x & "</OPTION>" next response.write "</select></td></tr>" elseif strField.name = "position" then response.write "<tr><th>" & strFieldN & ":</th><td><Select name='" & strField.Name & "'>" response.write "<option value='Goalkeeper'>Goalkeeper</option>" response.write "<option value='Defender'>Defender</option>" response.write "<option value='Midfielder'>Midfielder</option>" response.write "<option value='Striker'>Striker</option>" response.write "</select></td></tr>" end if Next set rsTbl =
1) Option explicit should always be at the TOP of the document, not top of the code, so the first line on the page should be <% Option Explicit %>
2) Use flags to see where the code is failing. For example in certain points of the code do something like <%response.write("im here")%> then you can track the data flow and pinpoint the location of the error
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum
Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.
Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.