473,569 Members | 2,791 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Mulitple Input Values passed from Popup Window

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.inte rnet.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="JavaS cript">

<!-- 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,lef t=150,width=325 ,height=300');
if (!newwin.opener ) newwin.opener = self;
with (newwin.documen t)
{
open();
write('<html>') ;
write('<body onLoad="documen t.form.box.focu s()"><form name=form
onSubmit=window .close()> <br>');
write('<p>' + name + ' ');
write('<p><cent er> Sender: <input type=text name=box size=20
onKeyUp=' + output + '=this.value>') ;
write('<p><inpu t 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,lef t=150,width=325 ,height=300');
if (!newwin.opener ) newwin.opener = self;
with (newwin.documen t)
{
open();
write('<html>') ;
write('<body onLoad="documen t.form.box.focu s()"><form name=form
onSubmit=window .close()> <br>');
write('<p>' + name + ' ');
write('<p><cent er> Sender: <input type=text name=box size=20
onKeyUp=' + output + '=this.value>') ;
write('<p><inpu t 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.documen t.form.username .value');">
<center>
<form name=form method=post>

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

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

</form>
</center>

</BODY>
</html>

Thanks for any help - Billy

Mar 24 '06 #1
2 6925
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(na me, billing, output, output2) {
newwin = window.open('', '','top=150,lef t=150,width=500 ,height=200');
if (!newwin.opener ) newwin.opener = self;
with (newwin.documen t)
{
open();
write('<html>') ;
write('<body onLoad="documen t.form.box.focu s()">');
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('BillingT o: ');
write('<input type=text name=billingtob ox 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="shippin gform('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.documen t.form.username .value',
'opener.documen t.form.billingt obox.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="billingto box" 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.

Mar 24 '06 #2
ja*********@gma il.com wrote:
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:
You mean the `head' _element_, which consists of an optional
start tag, content, and an optional end tag, in HTML 4.01.
<!-- Begin
Obsolete, potentially harmful nonsense. Remove it.
function shippingform(na me, billing, output, output2) {
newwin = window.open('', '','top=150,lef t=150,width=500 ,height=200');
I hope `newwin' is declared somewhere with `var'.
if (!newwin.opener ) newwin.opener = self;
Nonsense, remove it.
with (newwin.documen t)
{
The `with' statement is deprecated because of its side effects, and it is
unnecessary here.
open();
write('<html>') ;
The markup that you are generating (and that contains the generating code)
is not Valid HTML.

<URL:http://validator.w3.or g/>
write('<body onLoad="documen t.form.box.focu s()">');
Consecutive calls of document.write( ) are inefficient and error-prone,
especially when only a tag and not the whole element is written. Should
be more like

newwin.document .write(
'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"'
+ ' "http://www.w3.org/TR/html4/loose.dtd">'
+ '<html>'
+ ...);

The most efficient way is joining an Array:

newwin.document .write([
'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"',
' "http://www.w3.org/TR/html4/loose.dtd">',
'<html>',
...
].join('\n'));

The latter is supposed to work since JavaScript 1.3 (NN 4.06, 1998 CE),
JScript 2.0 (IE 2.0, 1996/1997 CE), and in ECMAScript Edition 3 (December
1999 CE) implementations .
[...]
// End -->
Unnecessary. Remove it.
[...]
<body ONLOAD="shippin gform('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.documen t.form.username .value',
'opener.documen t.form.billingt obox.value');">
Element types _and_ attribute names should be lowercase, even though
HTML is case-insensitive regarding this.

When event handler code turns into spaghetti code like this, it should
be moved into a function, and that function should be called instead.
<form method="POST" name="form">
The `action' attribute is missing, and the form most certainly does not
need a name. There is the document.forms collection; if the form is
the first or only one within the document, it can be referred backwards
compatible and standards compliant with `document.forms[0]'. The name
`form' is unwise anyway, especially when used in proprietary syntax
`document.form' because `document.forms ' exists.
[...]
Here are the text boxes on the main page:

<input type="text" name="username" size=53>
type="text" is redundant here, and all attribute values should be quoted.
<input type=text name="billingto box" 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.
Your current code will close the window before anything of the input can
be processed or submitted, due to `onsubmit=windo w.close()' [where the
attribute value MUST be enclosed in single or double quotes because of
the `(' or `)'].

Return `false' to the `onsubmit' handler if you want the form not to be
submitted, and do not call window.close() unconditionally if you do not
want the window to be closed always.
Also, somehow the onsubmit stopped working.
It never worked this way. `onsubmit' code is executed when the `submit'
event of the form occurs, i.e. if the submit button is activated or
(usually) the Return key is pressed when an input control has focus,
_before_ the form is actually submitted.
So the only way to close the popup is to click the button or click the
red X.
There is no red X here. You must be talking about one of the dozens of
window managers or user agents out there.
Any suggestions?


Read the FAQ, search the archives, so get a minimum clue,
and then get back here. <URL:http://jibbering.com/faq/>
PointedEars
Mar 24 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2961
by: Peter Kirk | last post by:
Hi, I want to open a popup-window which displays a list to the user. From this list, the user can select an item, and the data regarding this item is then transferred to some fields on the main window (and the popup then closes). But I am having several problems. I have an example "main.html" which opens an example "lookup.html". In the...
6
7075
by: veganeater | last post by:
Hi Everyone, I was wondering if there was a way to pass a variable to a popup window. The purpose is make it so when a user clicks on a specific region/link of the glossary page, a popup opens with the related description. This is done and is obviously not a concern. However, now I would like to make it so the corresponding row becomes...
2
2203
by: maxrawson | last post by:
Greetings all: I have an asp.net application that is coded mainly in vb.net. I have successfully cut and pasted some javascript into my application that mimicks the datetime picker control in vb. I wanted to try to use that same code for another popup style window that displays a list of airport codes in a datagrid. The desired results...
5
2412
by: Steve | last post by:
Hi, I currently have a problem passing a variable value from one page to another. Once a form submit button is pressed java pops up a window and displays some information. The problem being is variables value needs to be passed from the main page to this popup window ... but it isn't. why? the submit button one the PHP page is
1
4008
by: neena | last post by:
anyone please tell me how to pass the selected value from a listbox in popup window(child window) ,created using window.open() in javascript ,to a textbox in parent window please help me...
3
4696
by: simora | last post by:
Hi: Need some working sample code to post hidden form data from a php page to a new popup window. 540 x 500 centered. The popup that I'm calling already is formatted and has a TITLE:web-2007.php so what I need to do is to write the values from the PHP page to that popup in specific places. Some of the hidden values are also like this...
1
2109
by: selvamsivalingam | last post by:
i call the popup window through javascript by using the below code. <script language="javascript"> function hpclick() { var WinSettings = "center:yes;resizable:yes;dialogHeight:300px" window.showModalDialog("http://localhost:4911/WebSite19/Create_category.aspx",WinSettings); } </script>
18
3900
by: vjayis | last post by:
hi i am having a form which contains an text field., when the submit button is clicked the value of the textfield should be taken into the new popup window to display the results. i had tried but didnt get the solution., could anyone help me
11
5277
by: V S Rawat | last post by:
using Javascript, I am opening a web-based url in a popup window. MyWin1=Window.Open(url, "mywindow") There is a form (form1) in the url in that popup window, I need to submit that form. How do I submit that form1 from the javascript from my current window? Thanks.
0
7605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7917
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8118
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7665
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6277
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5501
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2105
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.