Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 7763
  • Last Modified:

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

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
lulu50
Asked:
lulu50
  • 4
  • 3
1 Solution
 
Russ SuterCommented:
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
 
lulu50Author Commented:
No,
I don't want to pass my long title and description into my URL!
0
 
Russ SuterCommented:
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
lulu50Author Commented:
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
 
Russ SuterCommented:
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
 
lulu50Author Commented:
Russ_Suter,

I got it!!!!!

Thank you
0
 
lulu50Author Commented:
Thanks,
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now