Forums

This topic is locked

MM_Username Problem w/no Help???

Posted 11 Jul 2003 16:24:44
1
has voted
11 Jul 2003 16:24:44 Katherine Williams posted:
I hope that someone can help me out. I've posted this same message on Macromedia's UltraDev forum to no avail. Please help me!!!

First, I'm using UD4, ASP, JavaScript & SQL Server 7

Basically, I have a registration page called appreg.asp that uses the "Check New Username" SB in UltraDev4. If the user enters a duplicate Username (MM_Username), they get redirected to appregpop.asp, which sends them an alert message and redirects them back to appreg.asp. It works great, but when the user gets redirected back to the appreg.asp page, all of the data they entered in previously is gone.

I thought the easiest way to accomplish this would be to somehow modify the SB code to get the appregpop.asp page to be in a separate window, but this SB doesn't give that option. I tried to modify the code myself, but I'm not sure how you use target="_blank" in ASP.

How can I get the "Check New Username" SB to keep the data in the fields that the user has already filled out? Does anyone know how to get the Check New Username SB to open the redirect page in another window similar to the target="_blank" method? The code for both pages is below, and you can see the 2 pages by visiting www.douglas-county.com/Employment/appreg.asp (NOTE: To test these pages online, use "paula" for the App ID.). Any help is greatly appreciated. Thanks.

KWilliams

Page 1 - appreg.asp
<%@LANGUAGE="JAVASCRIPT"%>
<!--#include file="Connections/strConn.asp" -->
<!--#include virtual="date_format.js" -->
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function checkPw(form) {
Password1 = form.Password1.value;
Password2 = form.Password2.value;

if (Password1 != Password2) {
alert ("\nYou did not enter the same new password twice. Please re-enter your password."
return false;
}
else return true;
}
// End -->
</script>
<%
// *** Redirect if username exists
var MM_flag="MM_insert";
if (String(Request(MM_flag)) != "undefined" {
var MM_valUsername=String(Request.Form("App_ID");
var MM_Password=String(Request.Form("Password1");
var MM_dupKeyRedirect="appregpop.asp"
var MM_rsKeyConnection=MM_strConn_STRING;
var MM_dupKeyUsernameValue = String(Request.Form("App_ID");
var MM_dupKeySQL = "SELECT App_ID FROM dbo.Employment_App WHERE App_ID='" + MM_dupKeyUsernameValue

+ "'"
var MM_adodbRecordset = "ADODB.Recordset";
var MM_rsKey = Server.CreateObject(MM_adodbRecordset);
MM_rsKey.ActiveConnection = MM_rsKeyConnection;
MM_rsKey.Source = MM_dupKeySQL;
MM_rsKey.CursorType=0;
MM_rsKey.CursorLocation=2;
MM_rsKey.LockType=3;
MM_rsKey.Open();
if (!MM_rsKey.EOF || !MM_rsKey.BOF) {
// the username was found - can not add the requested username
Session("MM_Username" = MM_valUsername;
Session("MM_Password" = MM_Password;
var MM_qsChar = "?";
if (MM_dupKeyRedirect.indexOf("?" >= 0) MM_qsChar = "&";
MM_dupKeyRedirect = MM_dupKeyRedirect + MM_qsChar + "App_ID=" + MM_dupKeyUsernameValue;
Response.Redirect(MM_dupKeyRedirect);
}
MM_rsKey.Close();
}
%>

Page 2 - appregpop.asp
<%
Dim App_ID
App_ID=Session("MM_Username"
if (App_ID <> "undefined" Then
%>
<html>
<head>
<script language="JavaScript">
onLoad=window.alert('You have entered a duplicate App ID. Please try again.') // An alert message is showed if no items were selected
location="appreg.asp" // If no items were selected, the navigator goes back to the "DefaultPage.asp"
</script>
<%
End If%>
</head>
<body bgcolor="#FFFFFF">
</body>
</html>

Replies

Replied 14 Jul 2003 13:59:20
14 Jul 2003 13:59:20 Lee Diggins replied:
Hi

If I understand you you need to refer to these two Session variables:

// the username was found - can not add the requested username
Session("MM_Username" = MM_valUsername;
Session("MM_Password" = MM_Password;

So your form page items could be set something like this:

<input name="txtUser" type="text" id="txtUser" value="<%=Session("MM_Username"%>">

Digga

Sharing Knowledge Saves Valuable Time!!!

Reply to this topic