belebala
June 1st, 2009, 04:11 PM
Hello, I'm having a problem to pass an input box value a variable.
I have an index page which contains the top and bottom frames. The top frame contains a combo box and I would like this selected combo box value passes to the bottom frame.
Top Frame JSP:
<html>
...
<script language="JavaScript">
function getProvinceValue(id){
var strGetProv=document.getElementById(id);
var strFilterProv = strGetProv.options[strGetProv.selectedIndex].value;
document.getElementById("hidProvFilter").value = strFilterProv;
parent.BottomFrame.document.getElementById("hidProvFilter").value = strFilterProv;
}
</script>
...
<body>
...
<td><select id ="ProvFilter" onchange="getProvinceValue('ProvFilter')">
<option value="British Columbia">BC</option>
<option value="Alberta">AB</option>
<option value="Saskatchewan">SK</option>
....
<form id="Toolbar" action ="topFrame.jsp" method ="POST">
<%
out.println("<input name=\"ProvinceFilter\" id=\"hidProvFilter\" value =\"Canada\">");
%>
...
</html>
Bottom Frame JSP:
<html>
<body>
...
<%
out.println("<input name=\"ProvinceFilter\" id=\"hidProvFilter\" value =\"\">");
String strProv = ??
//only print the filtered province
%>
...
</html>
From the above topFrame.jsp, it is already passed the strFilterProv to the bottomFrame.jsp, but how can this value passes to a java code (strProv) which I can do a filter?
I have an index page which contains the top and bottom frames. The top frame contains a combo box and I would like this selected combo box value passes to the bottom frame.
Top Frame JSP:
<html>
...
<script language="JavaScript">
function getProvinceValue(id){
var strGetProv=document.getElementById(id);
var strFilterProv = strGetProv.options[strGetProv.selectedIndex].value;
document.getElementById("hidProvFilter").value = strFilterProv;
parent.BottomFrame.document.getElementById("hidProvFilter").value = strFilterProv;
}
</script>
...
<body>
...
<td><select id ="ProvFilter" onchange="getProvinceValue('ProvFilter')">
<option value="British Columbia">BC</option>
<option value="Alberta">AB</option>
<option value="Saskatchewan">SK</option>
....
<form id="Toolbar" action ="topFrame.jsp" method ="POST">
<%
out.println("<input name=\"ProvinceFilter\" id=\"hidProvFilter\" value =\"Canada\">");
%>
...
</html>
Bottom Frame JSP:
<html>
<body>
...
<%
out.println("<input name=\"ProvinceFilter\" id=\"hidProvFilter\" value =\"\">");
String strProv = ??
//only print the filtered province
%>
...
</html>
From the above topFrame.jsp, it is already passed the strFilterProv to the bottomFrame.jsp, but how can this value passes to a java code (strProv) which I can do a filter?