Solved

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

Posted on 2014-04-22
7
7,029 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
Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

 

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
document.write() deleting all existing HTML 5 49
how can i make 2 columns? 4 37
Access RV042 GUI / Browser Issues 25 47
jquery + C#.net radiobuttonlist 3 29
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…

809 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