Solved

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

Posted on 2014-04-22
7
7,138 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

 

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

Independent Software Vendors: 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!

Question has a verified solution.

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

Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
This article discusses how to create an extensible mechanism for linked drop downs.
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…

733 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