PDA

View Full Version : Passing variables from child window to parent window


rico1931
07-07-2008, 05:23 AM
howdy there folks if you have read my previous post on sessions variables (http://www.dreamweaverclub.com/forum/showthread.php?t=28223) I apologize for the re post of this but I thought this was appropriate since its a different problem.

So I would like to know the best possible way to manipulate the DW code of the login behavior they have in CS3. The following is a login function that opens in a small 200x200 window from a link on the parent page and all I want to do is have once the submit button is pressed on the form to pass all the variabes to the parent window that would be open in the back. I have posted the login auth code and form.. thaks for any tips you give me on manipulating this code. I'm thinking this can be done but it prob means not using the login code DW provides and hand doing this my self which I complete understand but any help would or ideas would be nice.

Login Authorization code

' *** Validate request to log in to this site.
MM_LoginAction = Request.ServerVariables("URL")
If Request.QueryString <> "" Then MM_LoginAction = MM_LoginAction + "?" + Server.HTMLEncode(Request.QueryString)
MM_valUsername = CStr(Request.Form("Email"))
If MM_valUsername <> "" Then
Dim MM_fldUserAuthorization
Dim MM_redirectLoginSuccess
Dim MM_redirectLoginFailed
Dim MM_loginSQL
Dim MM_rsUser
Dim MM_rsUser_cmd

MM_fldUserAuthorization = "AUTH_LEVEL"[/COLOR]
MM_redirectLoginSuccess = "/SessionID2.asp"
[COLOR="rgb(46, 139, 87)"]MM_redirectLoginFailed = "/Default.asp"

MM_loginSQL = "SELECT AUTH_EMAIL, AUTH_PW"
If MM_fldUserAuthorization <> "" Then MM_loginSQL = MM_loginSQL & "," & MM_fldUserAuthorization
MM_loginSQL = MM_loginSQL & " FROM dbo.AUTH WHERE AUTH_EMAIL = ? AND AUTH_PW = ?"
Set MM_rsUser_cmd = Server.CreateObject ("ADODB.Command")
MM_rsUser_cmd.ActiveConnection = MM_DMICSQL_STRING
MM_rsUser_cmd.CommandText = MM_loginSQL
MM_rsUser_cmd.Parameters.Append MM_rsUser_cmd.CreateParameter("param1", 200, 1, 50, MM_valUsername) ' adVarChar
MM_rsUser_cmd.Parameters.Append MM_rsUser_cmd.CreateParameter("param2", 200, 1, 50, Request.Form("Password")) ' adVarChar
MM_rsUser_cmd.Prepared = true
Set MM_rsUser = MM_rsUser_cmd.Execute

If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then
' username and password match - this is a valid user
Session("MM_Username") = MM_valUsername
If (MM_fldUserAuthorization <> "") Then
Session("MM_UserAuthorization") = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization ).Value)
Else
Session("MM_UserAuthorization") = ""
End If
if CStr(Request.QueryString("accessdenied")) <> "" And true Then
MM_redirectLoginSuccess = Request.QueryString("accessdenied")
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginSuccess)
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginFailed)
End If
%>

Login form code

<form id="form1" name="form1" method="POST" action="<%=MM_LoginAction%>">
<label>Email:
<input type="text" name="Email" id="Email" />
</label>
<br />
<label>Password:
<input type="text" name="Password" id="Password" />
</label>
<br />
<input name="button" type="submit" id="button" value="Submit" />
</form>


Thanks for the help.. remember its through the login behavior in DWcs3
Hope the Americans had a happy Fouth!!!!

student101
08-12-2008, 09:11 AM
Here is what I googled, cool stuff this google thingy.

http://www.plus2net.com/javascript_tutorial/window-child3.php

http://dotnetslackers.com/Community/blogs/haissam/archive/2007/04/03/Passing-Data-Between-Parent-and-Child-window.aspx

Cheers

rico1931
08-12-2008, 01:06 PM
awesome thanks student101 i decided to take a dif approach and will consider this for next time. also yes google is a nice lil tool haha

student101
09-15-2008, 06:28 AM
Anytime :mrgreen: