Can anyone help me re-populate a form with completed data when a user selects an incorrect password or a username that already exists, to save the user re-inputting all details when only one aspect is incorrect or unusable?
My code is ASP using SQL statements, and seems to need a type of "If Update=True" statement. I can get a link to return to the Registration Form page, but with ALL fields blank again.
The following are excerpts from (1)CUSTFORM.ASP and
(2)CUSTADD.ASP (which writes back to custform.asp if errors).
CUSTFORM.ASP
<!-- REGISTRATION FORM -->
<FORM ACTION="custadd.asp?CartID=<%=CartID%>" NAME="formUser" METHOD="post"
onSubmit="justValidating=false; return validateForm(formUser)">
<P>Please provide the following information to register an account:</P>
<!-- Form Data -->
<TABLE BORDER="0">
<TR><TD>First Name:</TD>
<TD> <INPUT TYPE="text" SIZE="20" NAME="FName"
VALUE="<%=Request.Form("FName"
%>"></TD></TR>
<TR><TD>Last Name:</TD>
<TD><INPUT TYPE="text" SIZE="20" NAME="LName"
VALUE="<%=Request.Form("LName"
%>"></TD></TR>
<TR><TD>Email:</TD>
<TD><INPUT TYPE="text" SIZE="30" NAME="Email"
VALUE="<%=Request.Form("Email"
%>"></TD></TR>
<TR><TD COLSPAN=2>Please create a UserName and Password.
Record these in a safe place, as you will use them in the future
to sign in.</TD></TR>
<TR><TD>UserName:</TD>
<TD><INPUT TYPE="text" SIZE="20" NAME="UserName"
VALUE="<%=Request.Form("UserName"
%>"></TD></TR>
<TR><TD>Password:</TD>
<TD><INPUT TYPE="password" SIZE="20" NAME="Password"
VALUE="<%=Request.Form("Password"
%>"></TD></TR>
<TR><TD>Verify Password:</TD>
<TD><INPUT TYPE="Password" SIZE="20" NAME="VerPword"></TD></TR>
<TR><TD></TD>
<TD COLSPAN=2><BR>
<INPUT TYPE="Submit" VALUE="Submit">
<INPUT TYPE="Reset" VALUE="Reset" >
<INPUT ONCLICK="JustValidating=true; validateForm(this.form)"
TYPE=BUTTON VALUE= Validate></TD></TR>
</TABLE>
</FORM>
<%
Response.Write "<TABLE BORDER=0 WIDTH=600>" &_
"<TR><TD WIDTH=200><A HREF='itempage.asp?CartID=" & CartID & "'>" &_
"Category Details</A></TD>" &_
"<TD WIDTH=200>New User (Complete Form)</TD>" &_
"<TD WIDTH=200><A HREF='custadd.asp?CartID=" & CartID & "'>Login</A>" &_
" (Existing Customers)</TD></TR>" &_
"</TABLE>"
%>
CUSTADD.ASP
'CHECK WHETHER USERNAME ALREADY IN USE
While Not myRS.EOF
If myRS("UserName"
= UserName Then
Used = "yes"
End If
myRS.MoveNext
Wend
'IF USERNAME ALREADY USED, ADVISE TO CHOOSE ANOTHER
If Used = "yes" Then
Response.Write "<DIV ALIGN=CENTER><P>The UserName " & UserName &_
" is already taken. Please <A HREF='custform.asp?CartID=" & CartID &_
"'>go back</A> and choose another" &_
"</DIV>"
Else
'ACCEPT INPUT USERNAME
myRS.Close
myRS.Open "Customers", strConnect, adOpenKeyset, adLockOptimistic
myRS.AddNew
' ADD NEW USER DETAILS
myRS("UserName"
= UserName
myRS("FName"
= FName
myRS("LName"
= LName
myRS("Address"
= Address
myRS("City"
= City
myRS("County"
= County
myRS("PostCode"
= PostCode
myRS("Country"
= Country
myRS("Phone"
= Phone
myRS("Email"
= Email
myRS("Password"
= Password
myRS("UpdateD"
= Date
myRS("UpdateT"
= Time
myRS.Update
Thanks
Davie
My code is ASP using SQL statements, and seems to need a type of "If Update=True" statement. I can get a link to return to the Registration Form page, but with ALL fields blank again.
The following are excerpts from (1)CUSTFORM.ASP and
(2)CUSTADD.ASP (which writes back to custform.asp if errors).
CUSTFORM.ASP
<!-- REGISTRATION FORM -->
<FORM ACTION="custadd.asp?CartID=<%=CartID%>" NAME="formUser" METHOD="post"
onSubmit="justValidating=false; return validateForm(formUser)">
<P>Please provide the following information to register an account:</P>
<!-- Form Data -->
<TABLE BORDER="0">
<TR><TD>First Name:</TD>
<TD> <INPUT TYPE="text" SIZE="20" NAME="FName"
VALUE="<%=Request.Form("FName"

<TR><TD>Last Name:</TD>
<TD><INPUT TYPE="text" SIZE="20" NAME="LName"
VALUE="<%=Request.Form("LName"

<TR><TD>Email:</TD>
<TD><INPUT TYPE="text" SIZE="30" NAME="Email"
VALUE="<%=Request.Form("Email"

<TR><TD COLSPAN=2>Please create a UserName and Password.
Record these in a safe place, as you will use them in the future
to sign in.</TD></TR>
<TR><TD>UserName:</TD>
<TD><INPUT TYPE="text" SIZE="20" NAME="UserName"
VALUE="<%=Request.Form("UserName"

<TR><TD>Password:</TD>
<TD><INPUT TYPE="password" SIZE="20" NAME="Password"
VALUE="<%=Request.Form("Password"

<TR><TD>Verify Password:</TD>
<TD><INPUT TYPE="Password" SIZE="20" NAME="VerPword"></TD></TR>
<TR><TD></TD>
<TD COLSPAN=2><BR>
<INPUT TYPE="Submit" VALUE="Submit">
<INPUT TYPE="Reset" VALUE="Reset" >
<INPUT ONCLICK="JustValidating=true; validateForm(this.form)"
TYPE=BUTTON VALUE= Validate></TD></TR>
</TABLE>
</FORM>
<%
Response.Write "<TABLE BORDER=0 WIDTH=600>" &_
"<TR><TD WIDTH=200><A HREF='itempage.asp?CartID=" & CartID & "'>" &_
"Category Details</A></TD>" &_
"<TD WIDTH=200>New User (Complete Form)</TD>" &_
"<TD WIDTH=200><A HREF='custadd.asp?CartID=" & CartID & "'>Login</A>" &_
" (Existing Customers)</TD></TR>" &_
"</TABLE>"
%>
CUSTADD.ASP
'CHECK WHETHER USERNAME ALREADY IN USE
While Not myRS.EOF
If myRS("UserName"

Used = "yes"
End If
myRS.MoveNext
Wend
'IF USERNAME ALREADY USED, ADVISE TO CHOOSE ANOTHER
If Used = "yes" Then
Response.Write "<DIV ALIGN=CENTER><P>The UserName " & UserName &_
" is already taken. Please <A HREF='custform.asp?CartID=" & CartID &_
"'>go back</A> and choose another" &_
"</DIV>"
Else
'ACCEPT INPUT USERNAME
myRS.Close
myRS.Open "Customers", strConnect, adOpenKeyset, adLockOptimistic
myRS.AddNew
' ADD NEW USER DETAILS
myRS("UserName"

myRS("FName"

myRS("LName"

myRS("Address"

myRS("City"

myRS("County"

myRS("PostCode"

myRS("Country"

myRS("Phone"

myRS("Email"

myRS("Password"

myRS("UpdateD"

myRS("UpdateT"

myRS.Update
Thanks
Davie