Dear All
I am working on a Java based Web app - In this application, a window contains many textboxes which open the same child window. The user should choose among the option boxes provided and the choice should be reported back to parent window.
1. To know which textbox caused the child window to open, the two hidden inputs namely cbox and statbox are used to keep track.
2. The javascript code goes through the option boxes to find which one was chosen. then the value of two hidden textboxes are used to know which parent fileds should be filled with this data.
There is a problem with this code, could you please help me ?? It is not working as expected. The child window opens, but that is it :-(((((
3. Even though I have set (status=1,menubar=1) while opening window , I am not able to see the buttom status bar (I am using IE 6) so I can't really know what line is causing errors ? :-(((
4. How is it possible to transfer the value of text shown beside option box to parent as well ? can I use something like GetSelectedOption(${item[1]})
Thank you very much for your help
Maral
----------------------------------------------------------------------------------
[HTML]
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title> Displaying choices to the user </title>
<script language="text/javascript">
function GetSelectedOption() {
option1 = ""
thislen = document.childf1.CChoice.length;
for (i = 0; i < thislen; i++) {
if (document.childf1.CChoice[i].checked) {
option1 = document.childf1.CChoice[i].value;
}
}
if (option1 == "") {
alert("Please choose an option")
}
else {
var str1 = document.childf1.cbox.value;
var str2 = document.childf1.statbox.value;
//window.opener.focus();
opener.document.parentf1.getElementsByName(str1).v alue = option1;
opener.document.parentf1.getElementsByName(str2).v alue = option1;
window.focus();
window.close();
}
}
<script>
</head>
<body>
<form method="POST" name="childf1">
<table align="Center" border="0" cellpadding="0"
cellspacing="0" width="80%">
<c:forEach var = "item" items = "${MyArray}">
<tr>
<td> <input type="radio" name="Option1Choice" value="${item[0]}" onclick="GetSelectedOption()"/>${item[1]} </td>
</tr>
</c:forEach>
</table>
<input type="hidden" name="cbox" value="${CBox}" />
<input type="hidden" name="statbox" value="${StatBox}" />
<BR><BR>
</form>
</body>
</html>[/HTML]