Wrox Programmer Forums
|
BOOK: Beginning Dreamweaver MX/MX 2004 MX ISBN: 978-0-7645-4404-0; MX 2004 ISBN: 978-0-7645-5524-4
This is the forum to discuss the Wrox book Beginning Dreamweaver MX by Charles E. Brown, Imar Spaanjaars, Todd Marks; ISBN: 9780764544040
Please indicate which version of the book you are using when posting questions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Dreamweaver MX/MX 2004 MX ISBN: 978-0-7645-4404-0; MX 2004 ISBN: 978-0-7645-5524-4 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 24th, 2003, 07:47 PM
Authorized User
 
Join Date: Jul 2003
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default User Registeration Page

Hi Imar,

I am trying to build user registeration page for GlobalSoccerEvents.com. I am using Check New Username feature of DMX.
If name is already taken I want to show Regiteration page again with all the fields filled. How can I do it?

Thanks in advance,
Omer
 
Old July 25th, 2003, 04:29 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Omer,

The problem with the Check New Username behavior is that it redirects away from the page where you are validating the username when the name already exists. Even when you redirect to the same page again (addUser.asp for example) you loose your form fields, so you can't show them again. The only form field that is passed in the QueryString is requsername, which holds the requested username.

To overcome this situation, you'll need to perform the following steps:

1. Create addUser.asp
2. Add a Record Insertion Form that displays all the fields you want your user to fill in (i.e. UserName, LastName, FirstName, Password, etc.)
3. Add the Check New Username behavior.
4. Modify the code that DW inserted for this behavior:
Code:
Dim UserExists
If Not MM_rsKey.EOF Or Not MM_rsKey.BOF Then 
  ' the username was found - can not add the requested username
  MM_qsChar = "?"
  If (InStr(1,MM_dupKeyRedirect,"?") >= 1) Then MM_qsChar = "&"
  MM_dupKeyRedirect = MM_dupKeyRedirect & _
    MM_qsChar & "requsername=" & MM_dupKeyUsernameValue
  ' Don't redirect here, but set a flag instead
  UserExists = True
End If
5. In the rest of your code, you can use the UserExists boolean to determine further actions, like:
Code:
<%
  If UserExists = True Then
    Response.Write("This name has already been taken")
  End If
%>
6. To ensure that the form keeps its values, you'll need to add these values again to the value attribute of each HTML control. So, change:

<input type="text" name="Name" value="" size="32">

to

<input type="text" name="Name" value="<%=Request.Form("Name")%>" size="32">

The first time the form loads, Request.Form("Name") will not have a value, so the textbox will be empty. After you have checked the Username, Request.Form("Name") will contain a value, so it will be displayed in the textbox.

By using the UserExists boolean, you can display an error message, or determine whether the user account has been added correctly, and redirect to another page, for example.

I am leaving for holidays in a couple of hours, so I may not be able to respond to further questions for a while.....

HtH


Imar



---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old July 28th, 2003, 03:55 PM
Authorized User
 
Join Date: Jul 2003
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Imar.





Similar Threads
Thread Thread Starter Forum Replies Last Post
User name is blank in Login Page subhsam ASP.NET 1.0 and 1.1 Professional 0 March 14th, 2007 06:17 PM
GET WINDOWS USER ACCESING THE PAGE tbaquero Classic ASP Professional 3 September 24th, 2004 05:50 PM
Multiple user controls on a page kriskramer General .NET 2 September 14th, 2004 08:42 AM
JAVA SOAP and service registeration pcfeifei J2EE 0 May 19th, 2004 10:00 PM
knowing from where user entered my page? collie VB.NET 2002/2003 Basics 1 November 17th, 2003 11:32 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.