Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error Messages for Username and Password - ASP VBScript

Status
Not open for further replies.
May 13, 2008
24
US
Hello,

I am running into a problem trying to make a page for a user to add an account to a database. Right now, I have a form that the user fills out. From there, the form submits to a processing page that checks to make sure it is an original username and that the "password" and the "retype password" fields match. If the form values pass the check then it adds the record with an INSERT statement.

Does anyone know the best way to display these error messages when the user needs to pick another username or the passwords do not match. I am using a redirect method now, but it does not let me pass values back to the form with the appropriate error message. Because of this, I can't repopulate the text boxes with the information the user previously entered. I have been searching for a method to pass a form value through a processing page to the next page, but I just can't figure it out.

This is such a common thing, but I am a newbie. I am halfway decent at VBA, but I am finding gaps in my knowledge transferring it to ASP with VBScript.

I'd appreciate any help. This snag has been bothering me for a while now. Thanks in advance!
 
When you go from your original signup page to your process page I am guessing you are passing the form values using "request.form".

I think you could then set session variables to hold those values.
Code:
session("usernamehold") = request.form("username")
session("passhold") = request.form("password")
session("passrettypehold") = request.form("passwordretype")
I think you could then do your select against your user database with the proposed sign up ID to see if it is a unique user name. If everything is kosher you do your insert and display some welcome stuff.

If not you kick to a retry page with a form that looks the as the original sign up page and has the same action. On the retry page, you might be able to prepopulate the form fields with the session variables. I don't know.
Code:
<input id="username" name="username" type="text" value="<%= session("usernamehold")%>" />

 
Ahh....thank you so much. I tried it and it worked great!!! I just open the session variables in the processing page then close them out at the end of form I am passing the information to. Excellent.

Thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top