Solved

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

Posted on 2014-04-22
7
6,771 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
Comment Utility
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
Comment Utility
No,
I don't want to pass my long title and description into my URL!
0
 
LVL 20

Expert Comment

by:Russ Suter
Comment Utility
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

Author Comment

by:lulu50
Comment Utility
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
Comment Utility
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
Comment Utility
Russ_Suter,

I got it!!!!!

Thank you
0
 

Author Closing Comment

by:lulu50
Comment Utility
Thanks,
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

What is a Lightbox? A Lightbox is the effect you see when you click, for example, an image and the screen fades out and up pops the same image but in its full size dimensions. There are lots of Lightbox effects for jQuery. Problem is they are a…
How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
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…

762 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

11 Experts available now in Live!

Get 1:1 Help Now