Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return check box values from child po-up

Status
Not open for further replies.

japes89

IS-IT--Management
Oct 1, 2002
63
US
Does anyone know how to do this?
I saw a similar post with a drop down, but I cannot seem to modify it to allow multiple checkboxes.

Overview:
What I would like to do is have a pop-up window of a certain size with a form of check boxes. I would like the user to check any number of the 12 options and have those values returned to the main page with the values separated by a comma.

Thanks for the help!

JP _______________________________________________
OutsideIntranets.com
Stop wasting time, get to work
 
>> What I would like to do is have a pop-up window of a
>> certain size

see the FAQ's on window opening for that piece.

>> have those values returned to the main page with the
>> values separated by a comma.

so create a function in the popup window that builds an array of text values for each checked checkbox. Call the Array.join() function to create a delimited string of all the Strings in the array. Use the "window.opener" property to communicate with the parent "opener" window.

Code:
function doTest(){

	var names = new Array("cb1","cb2","cb3");
	var a = new Array();
	for(n=0; n<names.length; n++)
		if( document.getElementById(names[n]).checked)
			a[a.length] = names[n];
	
	// fill the target with the joined array values
	window.opener.document.getElementById(&quot;test2&quot;).value =
		a.join(&quot;,&quot;);
}
good luck
-pete
 
Been trying to get this to work. I think I may need a little handholding. I guess I do not see how the input tags fit in a swell as what the &quot;test2&quot; value represents. _______________________________________________
OutsideIntranets.com
Stop wasting time, get to work
 
>> what the &quot;test2&quot; value represents.

that would represent a <input type=&quot;text&quot; id=&quot;test2&quot;> on the &quot;opener&quot; page. Of course you don't have one but it was given as an example of how you can communicate with the &quot;opener&quot; page.

>> how the input tags fit in

Don't get what you mean there.

-pete

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top