473,466 Members | 1,436 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Passing variables beween windows

I know this looks like it has been answered 1000 times but I have a
slightly different problem.

I am dealing with forms in order to populate a database.
2 windows :
-Main window with my main form and the code to save the info into the
database.
There I also have a link to open a secondary window.
-Secondary window: checkbox (multiple choices) for the user to choose
from.

Obviously what I want is to capture the info from the checkboxes of
the secondary window ,send it to a variable within my main window and
then use that variable to send to my database.

the tricky part is that my main window is already open, and I don't
want to create a new one. I also don't want to show the user choices
again in any field, I just wants to be able to get the info into a
variable...

I have been searching around for a few days found some solutions but
not exactely what I need.

thanks for you help
Gabriel

Feb 28 '07 #1
7 1637
On Feb 28, 4:17 pm, "Cordouan" <gababa2...@yahoo.comwrote:
I know this looks like it has been answered 1000 times but I have a
slightly different problem.

I am dealing with forms in order to populate a database.
2 windows :
-Main window with my main form and the code to save the info into the
database.
There I also have a link to open a secondary window.
-Secondary window: checkbox (multiple choices) for the user to choose
from.

Obviously what I want is to capture the info from the checkboxes of
the secondary window ,send it to a variable within my main window and
then use that variable to send to my database.

the tricky part is that my main window is already open, and I don't
want to create a new one. I also don't want to show the user choices
again in any field, I just wants to be able to get the info into a
variable...

I have been searching around for a few days found some solutions but
not exactely what I need.

thanks for you help
Gabriel
please please somebody help...

Mar 1 '07 #2
ASM
Cordouan a écrit :
>>
I am dealing with forms in order to populate a database.
2 windows :
-Main window with my main form and the code to save the info into the
database.
There I also have a link to open a secondary window.
-Secondary window: checkbox (multiple choices) for the user to choose
from.

Obviously what I want is to capture the info from the checkboxes of
the secondary window ,send it to a variable within my main window and
then use that variable to send to my database.
jusque là ça va, assez fastoche.
quite easy

var mother = opener.document.myForm;
var daudhter = document.myForm;
var result = '';
for(var i=0; i<daughter.length; i++)
if(daughter[i].type == 'checkbox' && dughter[i].checked)
result += daughter{i].value+',';
mother.result.value = result;
self.close();
>the tricky part is that my main window is already open, and I don't
want to create a new one. I also don't want to show the user choices
again in any field, I just wants to be able to get the info into a
variable...
Why would you want to open a new window ?

Quite easy ---in popup when you press the validate button :

var daudhter = document.myForm;
var result = '';
for(var i=0; i<daughter.length; i++)
if(daughter[i].type == 'checkbox' && daughter[i].checked) {
result += daughter[i].value;
if(i<daughter.length-1) result += ',';
}
opener.myVariable = result;
/* or better :
opener.myFunction(result);
*/
self.close();
--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Mar 1 '07 #3
Merci stephane et son vieux mac !
Thanks a lot I am trying that ....

On Mar 1, 1:14 pm, ASM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
wrote:
Cordouan a écrit :
I am dealing with forms in order to populate a database.
2 windows :
-Main window with my main form and the code to save the info into the
database.
There I also have a link to open a secondary window.
-Secondary window: checkbox (multiple choices) for the user to choose
from.
Obviously what I want is to capture the info from the checkboxes of
the secondary window ,send it to a variable within my main window and
then use that variable to send to my database.

jusque là ça va, assez fastoche.
quite easy

var mother = opener.document.myForm;
var daudhter = document.myForm;
var result = '';
for(var i=0; i<daughter.length; i++)
if(daughter[i].type == 'checkbox' && dughter[i].checked)
result += daughter{i].value+',';
mother.result.value = result;
self.close();
the tricky part is that my main window is already open, and I don't
want to create a new one. I also don't want to show the user choices
again in any field, I just wants to be able to get the info into a
variable...

Why would you want to open a new window ?

Quite easy ---in popup when you press the validate button :

var daudhter = document.myForm;
var result = '';
for(var i=0; i<daughter.length; i++)
if(daughter[i].type == 'checkbox' && daughter[i].checked) {
result += daughter[i].value;
if(i<daughter.length-1) result += ',';
}
opener.myVariable = result;
/* or better :
opener.myFunction(result);
*/
self.close();

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date

Mar 1 '07 #4
OK I am still having some problem here.
this does work great in my daughter window I am capturing the checkbox
fine into a variable, but it is still not updating the parent window.

I have tried (result being the value I want to transfer and Answer the
variable in the parent window that I am hoping to send to)
in the daughter:
-opener.Answer = result;
-opener.Answer.value = result;
while I have in the parent (just for testing)
document.write("ma value " + Answer);

Encore un petit coup de pouce stephane ?
Please a little more help for me ?
thanks

Mar 1 '07 #5
ASM
Cordouan a écrit :
OK I am still having some problem here.
this does work great in my daughter window I am capturing the checkbox
fine into a variable, but it is still not updating the parent window.
Que veux-tu dire par "updating" ?
Que veux-tu y modifier ?
(quel champ de quel formulaire ?)
I have tried (result being the value I want to transfer and Answer the
variable in the parent window that I am hoping to send to)
in the daughter:
-opener.Answer = result;
in mother window (parent window it is for framed pages)
function tellMe() {
forms[0].result.value = Answer;
}

in daughter (the popup) :
opener.Answer = result;
opener.tellMe();

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Mar 2 '07 #6
Yes that works great.
Calling a function in the parent window makes it work.

MERCI
Ca me permet de repartir ca...

Thanks

Mar 2 '07 #7
ASM
Cordouan a écrit :
Yes that works great.
Calling a function in the parent window makes it work.

MERCI
Ca me permet de repartir ca...
encore plus simple et direct :

In mother window (main window) :

function tellMe(where, what) {
forms[0].elements[where].value = what;
}

In daughter (the popup) :

opener.tellMe('games', result);

and no more need specific mother variable(s) to communicate

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Mar 2 '07 #8

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

Similar topics

3
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
11
by: Johnny | last post by:
I'm a rookie at C# and OO so please don't laugh! I have a form (fclsTaxCalculator) that contains a text box (tboxZipCode) containing a zip code. The user can enter a zip code in the text box and...
8
by: Johnny | last post by:
I'm a rookie at C# and OO so please don't laugh! I have a form (fclsTaxCalculator) that contains a text box (tboxZipCode) containing a zip code. The user can enter a zip code in the text box and...
6
by: Scott Zabolotzky | last post by:
I'm trying to pass a custom object back and forth between forms. This custom object is pulled into the app using an external reference to an assembly DLL that was given to me by a co-worker. A...
0
by: Neelima Godugu | last post by:
Hi All, I have developed a windows forms user control, which I am going to host in Internet Explorer.. I am familiar with the security settings requirement inorder to do the above. I have...
3
by: IntraRELY | last post by:
I have the following function, Notice how I am passing the dateInterval as a string. What is the correct way to pass "DateInterval.Year" as a variable to a function? TIA, Steve Wofford...
61
by: academic | last post by:
When I declare a reference variable I initialize it to Nothing. Now I'm wondering if that best for String variables - is "" better? With Nothing I assume no memory is set aside nor GC'ed But...
12
by: Andrew Bullock | last post by:
Hi, I have two classes, A and B, B takes an A as an argument in its constructor: A a1 = new A(); B b = new B(a1);
1
by: sovereign6 | last post by:
Hello All, I have created my site in Dreamweaver MX2004. It appears that the page does not display correctly in IE 6.00 or Firefox Version 2 but no problem in Opera 8 or 9. A gap appears...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
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...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.