473,396 Members | 1,847 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Problem Passing value form popup window to parent window without refresh the parent

I require to appear the Name which i click on the "new.php" page in the "Window_open.php" page..I use some Java Script also to accomplish this but I couldn't..

Could you pleas Help ...!!!

Expand|Select|Wrap|Line Numbers
  1. ----------The Code in "Window_open.php" -------------------
  2.  
  3. <html>
  4.  
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
  7. <title>New Page 1</title>
  8. </head>
  9.  
  10. <body>
  11.  
  12.  
  13. <FORM>
  14. <INPUT type="button" value="New Window!" onClick="window.open('new.htm','mywindow','width=400,height=200')">
  15. <br>
  16. </FORM> 
  17.  
  18. <table width="533" height="242" border="1">
  19.   <tr>
  20.     <td align="center" valign="middle">Name<br><?php echo $post["txt"]?></td>
  21.   </tr>
  22. </table>
  23. </body>
  24.  
  25. </html>
  26.  
  27.  
  28. ------------------code in "new.php"---------------------------------
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <body>
  3.  
  4. <p><font size="5">This is the result of&nbsp; on click Opening 
  5. Window..............</font><br>
  6. <br>
  7. <br>
  8. <a id="100" onClick="window.close(),pass(100)">Taniya Moses<br></a>
  9. <a id="101" onClick="window.close(),pass(101)">Ranjan Ramanayaka<br></a>
  10. <a id="102" onClick="window.close(),pass(102)">Wikram Silva<br></a>
  11. <a id="103" onClick="window.close(),pass(103)">Wikram Silva<br></a>
  12. <a id="104" onClick="window.close(),pass(104)">Janaka Wujerathna<br></a>
  13. <br>
  14.  
  15.  
  16. <Script type="text/javascript">
  17. function pass(I)
  18. {
  19. var C = document.getElementById("I").value;
  20. document.getElementById("txt").value = C;
  21. window.location.href="new.html";
  22. //window.close();
  23. }
  24. </Script>
  25. </p>
  26. <form action="window_open.html", method="post">
  27. <input type="hidden" id="txt" name="txt"  />
  28. </form>
  29.  
  30. </body>
  31.  
  32. </html>
Attached Files
File Type: zip Lahiru778_Pages.zip (1.0 KB, 319 views)
Aug 16 '09 #1
12 7332
gits
5,390 Expert Mod 4TB
could you please explain your requirement a bit better ... step by step ... so that it is more clear what you want to achieve?

kind regards
Aug 16 '09 #2
-Attach containing 2 pages
01).window_open.php
02).new.php

Window_open.php is the main page and new .php is the popup window of Windows_open.php

[Please Download the attachment and run the Window_Open.php]

-Click on the bottom and then appear the list of name in the popup window..

Requirment:-
I require to display the name which appear in the popup window("new.php") in the main page (window_open.php), when click on a name of the opoup window.



Example:- Run the window_open.php and click on the button. "in side the popup window there is a list of name appearing..Click on a name..

The name should be appear in the main window by closing the popup window...
Attached Files
File Type: zip Lahiru778_Pages.zip (1.0 KB, 192 views)
Aug 16 '09 #3
gits
5,390 Expert Mod 4TB
threads merged ... please don't double post your questions and keep all things that are related to a specific problem in one thread.

MOD
Aug 16 '09 #4
gits
5,390 Expert Mod 4TB
to your problem ... when you need to pass a value from a child window to the parent window then you might make use of the child window's opener property ... which refers to the parent window.

kind regards
Aug 16 '09 #5
There is some small miss in my Syntax..Because of that the code is not working..Can you please go through the Syntax in child window("new.php") and correct it for me ..
I really appreaciate if you can....
Aug 16 '09 #6
gits
5,390 Expert Mod 4TB
do you need it to be posted to your opener php-page or just have it in the opener window. you current code looks more like you want to have it posted to the server ... but i cannot see a submit?
Aug 17 '09 #7
What I want is
Copy the folder in to Appachi server and run
(please change the new.htm to new.php in the "Window_Open.php" & "New.php" page code.)[Mistakenly i have put .html inside the syntax]
run
http://localhost:6060/Lahiru778_Pages/Window_Open.php

In that window Click on the "New Window Button" -----------> Child window popping up with list of names -----------> When you click on a name that name should be appear in the Parent Page by closing the pop up window.

Problem--->
The pop up window(new.php) already closing but the Name is not passing to the parent page ("Window_Open.php") from the Child window (new.php)
Aug 17 '09 #8
gits
5,390 Expert Mod 4TB
i will not install any sources and test php code at my side, this is the javascript forum and i could help you with that, to get you on track ... so since you basicly didn't answer my question and just insist to have your code tested and reviewed without saying what really should happen ... i GUESS now that you want to close the popup and want to have a value set to a node in your parent page? ... here is a simple example for how this could be achieved:

Expand|Select|Wrap|Line Numbers
  1. <html xmlns="http://www.w3.org/1999/xhtml">
  2.  
  3. <head>
  4. <script type="text/javascript">
  5.  
  6. function openWindow() {
  7.     var win = window.open('', 'mywindow', 'width=400,height=200');
  8.     win.document.body.innerHTML = [
  9.         '<a id="100"',
  10.         'onclick="opener.setName(\'foobar\');',
  11.         'window.close();>Taniya Moses<br></a>'
  12.     ].join('');
  13. }
  14.  
  15. function setName(val) {
  16.     document.getElementById('nameVar').innerHTML = val;
  17. }
  18.  
  19. </script>
  20. </head>
  21. <body>
  22.     <div id="foo" onclick="openWindow();">click here to open window</div>
  23.     <br/><br/>
  24.     <div id="nameVar">no name present</div>
  25. </body>
  26. </html>
  27.  
as you see this code makes use of the opener that refers to the parent window and calls a method that is defined there already. there are several ways to get that to work and the shown one above is just a simple example. so in case you just need it in the window then you could do it that way ... when you need it in a php-page then you need to post it to it.
Aug 17 '09 #9
Here I attached a word document by clearly mentioning about my requirement...
please refer the doc. You will able to get the clear idea about exactly what I want.

I try with AJAX but still I couldn't find the correct code that work this done.

If you can do this I really Appreciated ............
Attached Files
File Type: zip Problem in passing values.zip (5.2 KB, 145 views)
Aug 24 '09 #10
gits
5,390 Expert Mod 4TB
threads merged again ... DON'T post the same questions twice or triple times ... keep everything that is related to one question in ONE thread ...

MOD
Aug 24 '09 #11
gits
5,390 Expert Mod 4TB
to the problem ... your requirement was already clear ... and a possible solution was shown in a previous post ... show what you have tried so far. nobody will do a complete solution for you ... since that is not the intention of this forum.

regards
Aug 24 '09 #12
Ok Thanks...Thank you very much my friend
Aug 24 '09 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: HolaGoogle | last post by:
Hi, Sorrryy to ask such basic question but i do need your help! Here's what i'm trying to do: In my parent form i'm calling a my Iframe form to get certain value, then depending on that value...
3
by: MEM | last post by:
Hello, I'd like to refresh the main or top most browser window from a child window. Specifically, child popup A is opened by a main browser window then child popup B is opened from within child...
2
by: maxrawson | last post by:
Greetings all: I have an asp.net application that is coded mainly in vb.net. I have successfully cut and pasted some javascript into my application that mimicks the datetime picker control in...
3
by: Tyrone Slothrop | last post by:
The first question, is this even possible? What I need to do is pass the contents of a PHP web page from a textarea using window.open method to a new browser window and display it. The page has...
4
by: Davey | last post by:
I have a website which has a popup window (this only opens when the user chooses to open it). In the popup window I have a <select> control which lists a selection of "classes". Each class has a...
3
by: Aaron | last post by:
I am having a little difficulty with a relatively simple task. I have a parent webform. I have a javascript attribute added to a button to open a new window when clicked. The user fills in a...
2
by: Kapil Jain | last post by:
Dear All, Please assist me for below code : What i need is -> One "Patient Master" form for online Entry : My AIM -> When somebody want to add new patient a parent form will open than finally...
0
by: mathewgk80 | last post by:
HI all, I am having popup calendar Javascript code. But i dont know how it is connecting to asp.net code.. I am using asp.net,c#.net and also using 3tier architecture with master page.... I...
2
by: Bam | last post by:
Hey gang. I have searched the web, and can't find what i need. hoping someone here can help i have a form that pops up based on a click. the popup opens up correctly. now what i want it to do is...
12
meenakshia
by: meenakshia | last post by:
hi forum i have read a lot of articles regarding passing data from popup to parent up but i m looking for the opposite that is from parent to popup window pls help me in this regard i have...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...

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.