Solved

Carrying values from a form to a pop up box with Javascript

Posted on 2002-03-26
9
221 Views
Last Modified: 2013-11-28
I want to have a login area on the homepage and once users fill in their username and password I want to use a pop up box on the screen to tell them the results.  

The problem: I can't get seem to carry the values from the 2 fields, useranme & password, from the homepage to the pop up box using Javascipt.

I can use Javacript to launch the pop up window but not carry the values across.

Any ideas?

One thing I don't want to do is use a querystring or something that exposes values because I don't want to show passwords.

Derek.

0
Comment
Question by:dgwest
  • 2
  • 2
  • 2
  • +3
9 Comments
 
LVL 2

Expert Comment

by:DanielBlais
ID: 6896819
You may call another page.  If the login and password are correct, store them in a session variables.  And them open the pop-up in javascript.  In the pop-up, verify the session variables are ok and display the data.
0
 
LVL 3

Accepted Solution

by:
barryfandango earned 50 total points
ID: 6896844
dgwest,

Please elaboriate on what you mean by "the results."  What is it you wish to display in this popup window?

I'm assuming your problem is that you want to pop up an ASP page that will verify the user's login and password.  How about this:

1. user inputs login/pw on main ASP page, hits Submit
2. main page reloads, passing itself the login/pw in the form of Form Data.
3. an ASP script at the top of the main page checks for form data, validates the login/password, and generates a javascript routine to pop up the results.

i.e.

<%
'check to see if form was submitted
if len(request.form("login"))>0 then
  ...(script to check l/p)...
  if validated = true then
    message = "You have been successfully logged in."
  else
    message = "Login or Password incorrect."
  end if
  response.write("<script language=""javascript"">")
  ...(etc. - generate a script to pop up a window displaying the "message" variable.)...
end if
%>

Hope this helps.
0
 
LVL 7

Expert Comment

by:weesiong
ID: 6896848
dqwest,

Javascript popup a xx.asp

in the xx.asp validation the password, and response.redirect goto other page --> Password Correct/Password Error

In this case, when in the last page, use canot see the querystring. and you can pop up a page to disable the header for the browser, more safe.

Best Regards,
Wee Siong
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:dgwest
ID: 6896941
barryfandango,

I like what you've proposed.  Let me try it.  I don't know how to fire the javascript popup window though.  
0
 

Expert Comment

by:taftman
ID: 6896996
javascript popup window:

function openWin(){
window.open("yourPage.html","NameOfPage","width=550,height=550,screenX=300,screenY=90")
}
0
 

Expert Comment

by:taftman
ID: 6896999
or do you mean an "alert box"?

alert("stuff in here");

or displaying variables:

alert(foo);
0
 
LVL 3

Expert Comment

by:barryfandango
ID: 6897008
dgwest,

you could create two HTML files, one with the confirmation message and one with the denial message.

modify the above script to read like:

if validated = true then
   message = "yes.html"
else
   message = "no.html"
end if

Then create your new window:

response.write("<script language=""javascript"">")
response.write("window.open(" & message & ",""theWindow"",""height=200,width=200,menubar=no,directories=no,scrollbars=no,toolbar=no, resizable=no"")")
response.write("</script>")

Within yes.html and no.html, you might want to include a button that fires "window.close()".
0
 

Author Comment

by:dgwest
ID: 6897013
barryfandango,

I like what you've proposed.  Let me try it.  I don't know how to fire the javascript popup window though.  
0
 
LVL 2

Expert Comment

by:manihopever
ID: 6898915
Dear dqwest,

i have just coded a sample, make few changes and flexible things to work.

login.asp
----------
<script language=javascript>
  function showPopup(){
    pop= window.open("validate.asp","validate","width=100, height=200")
    document.frm.target = "pop"
    document.frm.submit()        
  }
</script>
<form name=frm onsubmit="">
<input type=text name=login>
<input type=password name=password>
<a href="javascript:void showPopup()">login</a>
</form>

validate.asp
------------
<%
strlogin = Request.Form("login")
strPwd   = Request.Form("password")
if strlogin="dqwest" and strpwd="pass" then
  response.write "welcome dqwest"
else
  response.write "illegal entry, please try again."  
end if  
%>
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Forcing form refresh - classic ASP 7 72
How to profit from my training video? 3 76
innerHTML 7 34
JQuery Autocomplete Tag AJAX (Need nice script) 11 34
Read about how to approach blogging and about ways to do it right. Stand out from the crowd and let your knowledge be consumed by a large audience. This article aims to explain how your blog should look like,  the most important things to do while b…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
An overview of how to create reports in Adobe Analytics (formerly Omniture Site Catalyst) using pageNames, events, eVars and props. This video will show you how to install the Omniture Debugger tool so can see (and test) what is being passed int…
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question