Solved

passing values through pop up

Posted on 2004-03-30
7
141 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
Marketing can be an uncomfortable undertaking, especially if your material is technology based. Luckily, we’ve compiled some simple and (relatively) painless tips to put an end to your trepidation and start your path to success.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

828 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