Mulitple Input Values passed from Popup Window

J

jackson2005

OK, I need to do three different things.

On the ONLOAD event I would like a popup box to open. In this popup
box I need two text boxes. One for the UserName and one for the
BillingTo name. After entering these two items the user can either hit
the enter key or press the submit button. The popup window will close
and then those two text boxes in the original webpage will be filled in
automatically.

I would like to have the two fields to be validated so the popup won't
close until both text boxes are filled in.

So far I have used the function from javascript.internet.com in the
header of the original page. I have tried to make so that when the
first popup closes the second popup will open. I can get the variables
to pass the main page but I feel it would be more effecient to have
both text boxes in the same popup instead of having two.

<html>
<head>
<SCRIPT LANGUAGE="JavaScript">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function explain(name, output) {
newwin = window.open('','','top=150,left=150,width=325,height=300');
if (!newwin.opener) newwin.opener = self;
with (newwin.document)
{
open();
write('<html>');
write('<body onLoad="document.form.box.focus()"><form name=form
onSubmit=window.close()> <br>');
write('<p>' + name + ' ');
write('<p><center> Sender: <input type=text name=box size=20
onKeyUp=' + output + '=this.value>');
write('<p><input type=button value="Click to close when finished"
onClick=window.close()>');
write('</center></form></body></html>');
close();
}
}

// End -->

<!-- Begin
function billingto(name, output) {
newwin = window.open('','','top=150,left=150,width=325,height=300');
if (!newwin.opener) newwin.opener = self;
with (newwin.document)
{
open();
write('<html>');
write('<body onLoad="document.form.box.focus()"><form name=form
onSubmit=window.close()> <br>');
write('<p>' + name + ' ');
write('<p><center> Sender: <input type=text name=box size=20
onKeyUp=' + output + '=this.value>');
write('<p><input type=button value="Click to close when finished"
onClick=window.close()>');
write('</center></form></body></html>');
close();
}
}
// End -->

</script>


</head>

<body ONLOAD="explain('Please enter the name of the person sending this
shipment here and it will be copied into the form for you.',
'opener.document.form.username.value');">
<center>
<form name=form method=post>

User Name: <input type=text name="username" size=10
onfocus="billingto('Please enter the billing to person',
'opener.document.form.billing.value');">

<br>
Password: <input type=text name="billing" size=10>

</form>
</center>

</BODY>
</html>



Thanks for any help - Billy
 
J

jackson2005

I have figured out how to have both text boxes into one popup and how
to get those values passed to the main page. Here is the code in my
head tag:

<!-- Begin
function shippingform(name, billing, output, output2) {
newwin = window.open('','','top=150,left=150,width=500,height=200');
if (!newwin.opener) newwin.opener = self;
with (newwin.document)
{
open();
write('<html>');
write('<body onLoad="document.form.box.focus()">');
write('<form name=form onSubmit=window.close()>');
write('<center>');
write('<br>');
write(name);
write('<br>');
write('Sender: ');
write('<input type=text name=box size=20 onKeyUp=' + output +
'=this.value>');
write('<br>');
write('<br>');
write(billing);
write('<br>');
write('BillingTo: ');
write('<input type=text name=billingtobox size=20 onKeyUp=' + output2 +
'=this.value>');
write('<br>');
write('<input type=button value="Click to close when finished"
onClick=window.close()>');
write('</center>');
write('</form>');
write('</body>');
write('</html>');
close();
}
}

// End -->

</script>
=======================
=======================

Here is my body tag:
<body ONLOAD="shippingform('Please enter the name of the person sending
this shipment here.', 'Enter Advanced.1, Client, or Personal for
verification on who will get billed',
'opener.document.form.username.value',
'opener.document.form.billingtobox.value');">
<form method="POST" name="form">

=======================
=======================

Here are the text boxes on the main page:

<input type="text" name="username" size=53>
<input type=text name="billingtobox" size=81>

=======================
=======================



The only thing I really need now is for some kind of verification to
happen. I don't want the popup to close until both fields are filled
in.

Also, somehow the onsubmit stopped working. So the only way to close
the popup is to click the button or click the red X. Any suggestions?

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top