473,725 Members | 2,180 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

pass values from popup window to another popup window

134 New Member
hi

i am having a form which contains an text field.,

when the submit button is clicked the value of the textfield should be taken into the new popup window to display the results.

i had tried but didnt get the solution.,

could anyone help me

here is my code;

(page name=first.php)


Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. function Newpopup(text)
  3. {
  4.   var  dd=document.getElementById("qq").value;
  5.   window.opener.document.newpopup_formname.fieldname.value = dd; 
  6.   win=window.open(text,'','width=1010px,height=800px,scrollbars=yes');
  7. }
  8. </script>
  9.  
  10.  
  11. <?
  12. $act=$_REQUEST['act'];
  13. $qq=$_POST['qq'];
  14.  
  15. if($act==1)
  16. {
  17. ?>
  18. <meta http-equiv="refresh" content="0;javascript:Newpopup('new_pop.php')" >
  19. <?
  20. }
  21. ?>
  22.  
  23.  
  24. <form name="form1" id="form1" action="first.php?act=1" method="post">
  25.  
  26. text field:<input type="text" id="qq" size="18" name="qq" value="<? if($act==1) echo $qq;?>">
  27.  
  28. <input name="submit" type="submit" value="Submit" />
  29.  
  30. </form>
  31.  
  32.  

so when i enter the value and click the submit button., the page gets reloaded but no pop-up window is popped out.,


thanks
regards
vijay
Jun 2 '08
18 3914
acoder
16,027 Recognized Expert Moderator MVP
You've not set "text" (the first parameter to window.open()). Either pass it as a parameter to the NewWindowd() function or set a variable text globally.
Jun 7 '08 #11
vjayis
134 New Member
You've not set "text" (the first parameter to window.open()). Either pass it as a parameter to the NewWindowd() function or set a variable text globally.

Tried doing the changes., but no changes found.,

the function itself is not called if i m calling it through php echo statement.,

Not even an alert message is displayed.,

Expand|Select|Wrap|Line Numbers
  1. <?
  2.       $act=$_REQUEST['act'];
  3.       $qq=$_POST['qq'];
  4.       if($act==1)
  5.       {
  6.       echo '<script type="text/javascript">NewWindowd();</script>';
  7.       }
  8.       ?>
  9.       <script type="text/javascript">
  10.       function NewWindowd()
  11.       {
  12.         alert("function called");
  13.         var dd=document.getElementById("qq").value;
  14.         var text="new_pop.php?data1="+dd;
  15.         win=window.open(text,'','width=1010px,height=800px  ,scrollbars=yes');
  16.       }
  17.      </script>
  18.  
  19.  
In the form ., the value is stored in an hidden field named and having id as "qq";
and that value is taken back in the javascript.,
and even tried by using
Expand|Select|Wrap|Line Numbers
  1. var dd=document.form1.qq.value;
  2.  
but nothing happens.,


The function itself didnt get called then how can these things happpen??
Even an alert message was displayed.,

Anyother way to solve this.,
Jun 9 '08 #12
acoder
16,027 Recognized Expert Moderator MVP
If the hidden field is not set after submit, or you're calling JavaScript code during page load, it won't be available to JavaScript. Try the code I gave earlier:
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. function Newpopup(text) {
  5.     win=window.open(text,'','width=1010px,height=800px,scrollbars=yes');
  6. }
  7. <?
  8.     $act=$_REQUEST['act'];
  9.     $qq=$_POST['qq'];
  10.     if ($act==1) {
  11.         $newpopup="new_pop.php?data1=".$qq;
  12.         echo "Newpopup('$newpopup');";
  13.     }
  14. ?>
  15. </script>
  16. </head>
  17. <body>
  18.     <form name="form1" id="form1" action="first.php?act=1" method="post">
  19.     text field:<input type="text" id="qq" size="18" name="qq" >
  20.     <input name="submit" type="submit" value="Submit" />
  21.     </form>
  22. </body>
  23. </html>
If it doesn't work, maybe you have a popup blocker running.
Jun 9 '08 #13
vjayis
134 New Member
Hi

got the solution.,

the popup doesnt popped out because i hav written the script below the form the page gets loaded., so it was not included in the fresh page.,

when i placed the script before the form it gets working.,

thanks for ur help
Jun 19 '08 #14
acoder
16,027 Recognized Expert Moderator MVP
Hmm... I thought you already had it before the form - see first few posts.

Anyway, glad it's working.
Jun 19 '08 #15
vjayis
134 New Member
yes probably i hav written it before the form., when switched from meta http redirect to JS., i hav placed them below., anyway it works well now.,
thanks.,

Now.,
i hav a text and when i click the text an function is called and a popup window appears.,
then if i again click the text again while the popup is available i dont want to give a new popup.,

And if i have closed the popup then the popup should come when i click on the text.,

any ideas.,
Expand|Select|Wrap|Line Numbers
  1. function NewWindow(text)
  2. {
  3.   win=window.open(text,'','width=480,height=250,right=65,bottom=5,scrollbars=no');
  4. }
  5.  
And
[code]
<a onclick="NewWin dow('filename') ">popup</a>[text in which the function is called while it is clicked]
Jun 20 '08 #16
acoder
16,027 Recognized Expert Moderator MVP
See this link - it shows how you can use only one popup window. If it doesn't exist, another one is created.
Jun 20 '08 #17
vjayis
134 New Member
See this link - it shows how you can use only one popup window. If it doesn't exist, another one is created.

hey thanks

tht linked helped me more to find out my solution.,
Jun 20 '08 #18
acoder
16,027 Recognized Expert Moderator MVP
You're welcome, glad it helped.
Jun 20 '08 #19

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

Similar topics

2
1615
by: Marco Antonio Montalvo Durán | last post by:
hi for example, I have a page 'register.aspx' and open a second page 'popup.aspx', what I want to do is to pass the control and values obtained in 'popup.aspx' to 'register.aspx', somebody help!!! thanks
1
9370
by: colleen1980 | last post by:
Hi: Can any one please tell me that how to i pass the two textbox values in the new page. If i use the form action in the popup window page then the new page is open in the same popup window as i need to open the new page in the main page window with passing the two textbox parameters into the new page. Program opens the new page but dont know how to pass the two textboxes values into the new page name deceasedToday.asp Needs help in...
1
2119
by: selvamsivalingam | last post by:
i call the popup window through javascript by using the below code. <script language="javascript"> function hpclick() { var WinSettings = "center:yes;resizable:yes;dialogHeight:300px" window.showModalDialog("http://localhost:4911/WebSite19/Create_category.aspx",WinSettings); } </script>
0
8752
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9401
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9176
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8097
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6702
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3221
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.