Solved

passing values through pop up

Posted on 2004-03-30
7
138 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
Comment Utility
Do you want to pass it to php or to javascript?
0
 
LVL 6

Expert Comment

by:CosminB
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
scandir() not reads all files 4 25
Mail Not Sent 6 41
Get Javascript URL parameters 7 27
php documentation 4 19
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

743 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

15 Experts available now in Live!

Get 1:1 Help Now