Hi
once my users have submitted an online form i let them edit their own details by logging in with a username/password.
the details are read from a recordset, the user can change any details and click update form, which checks the validation, if successful updates the record else highlights to the user their errors to correct.
I have the details in text boxes read from the recordset such as.......................
thats fine but if the user updates say the BusinessName field and Address field, if the BusinessName field doesn't meet the validation (i.e. is blank) the address field loses its changes too because the text box always says
value=""" & Address1 & """
which is going to revert back to the recordset value.
so my code flow goes abit like below
any ideas ?
once my users have submitted an online form i let them edit their own details by logging in with a username/password.
the details are read from a recordset, the user can change any details and click update form, which checks the validation, if successful updates the record else highlights to the user their errors to correct.
I have the details in text boxes read from the recordset such as.......................
Code:
BusinessName = objRS("BusinessName")
b = b & "<INPUT type=""text"" name=""BusinessName"" ID=""BusinessName"" size=""20"" value=""" & BusinessName & """ />"
thats fine but if the user updates say the BusinessName field and Address field, if the BusinessName field doesn't meet the validation (i.e. is blank) the address field loses its changes too because the text box always says
value=""" & Address1 & """
which is going to revert back to the recordset value.
so my code flow goes abit like below
any ideas ?
Code:
strSQL = "SELECT * FROM members where UserName = '" & Session("mID") & "'"
objRS.CursorType = 3 'adOpenStatic
objRS.CursorLocation = 3 'adUseClient
set objRS=ObjCon.execute(strSQL)
BusinessName = Request.Form("BusinessName")
Address1 = Request.Form("Address1")
If BusinessName = "" Then
ErrorMsg2 = ErrorMsg2 & "Please enter your Business Name<br></br>"
end if
If Address1 = "" Then
ErrorMsg2 = ErrorMsg2 & "Please enter a Address<br></br>"
end if
If ErrorMsg2 = "" Then
'update form
Response.Redirect "thank you page"
else
end if
If ErrorMsg2 <> "" Then
b = "<p><br></br><font color=""#FF0000"">" & ErrorMsg2 & "</font></p>"
else
end if
BusinessName = objRS("BusinessName")
Address1 = objRS("Address1")
b = b & "<FORM action=""web.asp?page=621"" METHOD=""post"" name=""formUpdate"">"
b = b & "<INPUT type=""text"" name=""BusinessName"" ID=""BusinessName"" size=""20"" value=""" & BusinessName & """ />"
b = b & "<INPUT type=""text"" name=""Address1"" ID=""Address1"" size=""20"" value=""" & Address1 & """ />"