
Hi,
Requirement: popup window having multiple checkboxes, I have to select couple of checkboxes and click the submit button.
I am unable to get the check box values... need help on this ....
my javascript code:
function openWin(form) {
var countryName = " ";
var countries = form.countries.value;
var myStringArray = new Array();
var stringCount = countries.split(",");
for(var i=0;i<(stringCount.length)-1;i++){
myStringArray.push(stringCount[i]);
}
for (var i = 0; i < myStringArray.length; i++) {
display=window.open('','NewWin','menubar=0,location=no,status=no,directories=no,toolbar=no,scrollbars=yes,height=500,width=500')
message="<font face='verdana, arial, helvetica, san-serif' size='2'><form>";
message+="<input type='checkbox' name='listCountry' value='myStringArray'/>" +myStringArray[i]+ "<br />";
message+="</form></font>";
display.moveTo(30,20);
display.document.write(message);
if(myStringArray[i].checked == true){
countryName = countryName + myStringArray[i] + " ";
}
}
message="<input type='button' name='countryName' value='Submit' />"+" "+" ";
message+="<input type='button' name='Cancel' value='reset' />" ;
display.document.write(message);
window.location.replace("ADTReports.jsp?countryName="+countryName);
}

in countries i am getting countries as India, France, Usa

1)index.html:
<html>
<form>
<input type="button" value="New Window!" onClick="window.open('subform.html','window','width=400,height=200')">
</form>
</html>
<%
String select[] = request.getParameterValues("id");
if (select != null && select.length != 0) {
out.println("You have selected: ");
for (int i = 0; i < select.length; i++) {
out.println(select[i]);
}
}
%>
2)subform.html:
<html>
<form action="index.html">
<pre>
Select Languages: <input type="checkbox" name="id" value="Java"> Java
<input type="checkbox" name="id" value=".NET"> .NET
<input type="checkbox" name="id" value="PHP"> PHP
<input type="checkbox" name="id" value="C/C++"> C/C++
<input type="checkbox" name="id" value="PERL"> PERL <BR>
<input type="submit" value="Submit">
</pre>
</form>
</html>

Change the extension of the code files to jsp.
1)index.jsp:
<html>
<form>
<input type="button" value="New Window!" onClick="window.open('subform.jsp','window','width=400,height=200')">
</form>
</html>
<%
String select[] = request.getParameterValues("id");
if (select != null && select.length != 0) {
out.println("You have selected: ");
for (int i = 0; i < select.length; i++) {
out.println(select[i]);
}
}
%>
2)subform.jsp:
<html>
<form action="index.jsp">
<pre>
Select Languages: <input type="checkbox" name="id" value="Java"> Java
<input type="checkbox" name="id" value=".NET"> .NET
<input type="checkbox" name="id" value="PHP"> PHP
<input type="checkbox" name="id" value="C/C++"> C/C++
<input type="checkbox" name="id" value="PERL"> PERL <BR>
<input type="submit" value="Submit">
</pre>
</form>
</html>