Solved

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

Posted on 2002-03-26
9
218 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
barryfandango,

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

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

Expert Comment

by:taftman
Comment Utility
javascript popup window:

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

Expert Comment

by:taftman
Comment Utility
or do you mean an "alert box"?

alert("stuff in here");

or displaying variables:

alert(foo);
0
 
LVL 3

Expert Comment

by:barryfandango
Comment Utility
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
Comment Utility
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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The next wave of Panda releases starts with Panda2.1 After the game-changing Panda2.0 update that caused a reduction in Google search engine referral traffic to a newly affected and larger set of websites, more Panda updates were already in the pip…
The most recent Google Panda algorithm update that I wrote about was Panda 2.5 (http://www.experts-exchange.com/Web_Development/Internet_Marketing/A_8112-Google-s-Panda-Algorithm-Update-Panda2-5.html), and there have been several iterations of the P…
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 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.

743 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

15 Experts available now in Live!

Get 1:1 Help Now