Solved

passing values through pop up

Posted on 2004-03-30
7
142 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying 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

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Online promotion is consistently becoming more important for all types of businesses. From Facebook ads to search engines to YouTube videos, there are all sorts of channels that can effectively be used to promote a business or product. But how shoul…
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.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…

752 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