Solved

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

Posted on 2002-03-26
9
219 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
 

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
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

With a software solution, you always get to control email signatures and have the final say on the design - not an unrelated department or the uninterested end user.
A great marketing strategy is diverse.  Read about the not so popular, yet effective, marketing tactics you can start using today!
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.

895 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now