Solved

Open up a popu window in jquery and pass the parameter from the main window

Posted on 2014-04-22
7
6,890 Views
Last Modified: 2014-04-22
Hi,

How can I do this function when the user click on a button, it should open a popup window and pass the title and description value.

first I need to be able to open the popup window from my main page.

second the value that I have from the main page textbox (title) should be able to send it to the popup window.

Thank you for helping.
Lulu

here's what I have so far:

This is on the main form.

    <input type="button" name="SubLogEntry" id="SubLogEntry" value="Submit Log" onclick="return ValidateForm();" >


 function ValidateForm() {

  var title = $("#TitleOfIssueTxt").val(); 
  var description = $("#Description").val(); 
  var DateOccurred= $("#DateIdentifiedtxt").val(); 
  var TicketNumber =  $("#SelectTicketNumber").val() + $("#TicketNumberTxt").val() ;    
			
			//here I want to open up a popup window target _blank  and pass all the parameter values above to the new popup window.

		   var href = "Finddup.cfm";
			window.open($(this).prop('Finddup.cfm'),
				'640,480');
			
			return true;
			
        } 

Open in new window

0
Comment
Question by:lulu50
  • 4
  • 3
7 Comments
 
LVL 20

Expert Comment

by:Russ Suter
ID: 40015503
You could just use http get and put the parameters into the URL. It might look something like this:

window.open($(this).prop('Finddup.cfm?param1=[value]&param2=[value]'),	'640,480');

Open in new window

0
 

Author Comment

by:lulu50
ID: 40015509
No,
I don't want to pass my long title and description into my URL!
0
 
LVL 20

Expert Comment

by:Russ Suter
ID: 40015535
OK, as an alternative you could put the values into hidden input elements on your parent window then reference them from your popup window like this:

parent.document.getElementById('hiddenTextField').value

Open in new window

0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:lulu50
ID: 40015760
I am not getting the value from the parent window!

this code in the popup window

<script type="text/javascript" src="js/jquery-1.10.2.min.js" ></script> 
<script type="text/javascript" src="js/jquery-ui.min.js"></script>

<script language="javascript" type="text/javascript">
    

	$.ajaxSetup({ cache: false });

	$(document).ready(function () {

var test = parent.document.getElementById('TitleOfIssueTxt').value
alert(test);

 $.ajaxSetup({ cache: false });


	});
	
	</script>

Open in new window

0
 
LVL 20

Accepted Solution

by:
Russ Suter earned 500 total points
ID: 40015770
2nd alternative, assign the return value of the window.open() method to a variable then you can set values from the variable.

var popupWindow = window.open();

popupWindow.document.getElementById('passedvalueTextbox').value = [somevalue]

Open in new window

0
 

Author Comment

by:lulu50
ID: 40015790
Russ_Suter,

I got it!!!!!

Thank you
0
 

Author Closing Comment

by:lulu50
ID: 40015791
Thanks,
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

895 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

17 Experts available now in Live!

Get 1:1 Help Now