Solved

passing values through pop up

Posted on 2004-03-30
7
140 Views
Last Modified: 2013-11-28
Hi,
   I want to pass a value from a pop up window to the parent window...this works using the code in the popup window

<a href="javascript:self.close()" onclick="opener.location='test.php?id=<?echo $a_rows["id"]?>'">test</a>

but this refreshes the parent window. Is it possible to pass the value without refreshing the parent window?

Sid
0
Comment
Question by:Sid123
  • 2
  • 2
7 Comments
 
LVL 6

Expert Comment

by:CosminB
ID: 10721487
Do you want to pass it to php or to javascript?
0
 
LVL 6

Expert Comment

by:CosminB
ID: 10721570
if you want to pass it to the same page that opened the window(to php not Javascript) you can't do it without refreshing the page. At most you can refresh only a part of your page that is contained in an iframe or a frame
0
 
LVL 7

Accepted Solution

by:
madwax earned 100 total points
ID: 10728228
The way you wrote your href it isn't possible without refreshing the page. What on the other hand is possible is to use javascript to do the job. Simply create e.g. a form and a text-field and then you can send the value back through a javascript function and DOM.

function xxx(){
  opener.form1.myField.value = y;
}

the function above sends the value to the form1 -> myField in the opener window without refreshing it...

Hope it helps...
//madwax
0
 

Author Comment

by:Sid123
ID: 10729559
Hi madwax,
    I actually didnt get what you wrote. I have a php file test.php which opens a popup test1.php . So I need to send some value from test1.php to test.php by closing the pop up i.e test1.php ....and as I said by using the code I am using test.php gets refreshed.
   If I go according to what you suggested...then how should I go about. I didnt understand form and text field part.


Sid
0
 
LVL 7

Expert Comment

by:madwax
ID: 10730081
Oki, sorry, It was kind of late when I wrote it.

It all depends on what kind on for what you want to use the variable sent from the pop-up. If you want to use it in the openers php-code, it isn't possible to do so without a refresh. On the other hand if you only want to dsiplay it on the opener page, or use it in some sort of e.g. javascript you can send it back to the opener through the DOM, i.e. use the path opener.object.attribute.value and an example of this can be a text-field within a form on the opener page as I wrote above. To conclude it all depends on what you want to use the variable for.

hope this made it a little bit clearer...
//jan
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Read about the 3 stages of the buyer's journey: awareness, consideration, and decision.
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

813 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

14 Experts available now in Live!

Get 1:1 Help Now