Sam Mercs wrote:Your code looks correct. At least nothing seems wrong, the second method of using a hidden variable should have worked. However it would be a lot better if you post the generated HTML code, since I can run that in my browser to see whats happening.
Here is the generated html code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="Description"
content="Information architecture, Web Design, Web Standards." />
<meta name="Keywords" content="your, keywords" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="Distribution" content="Global" />
<meta name="Author" content="Erwin Aligam -
[email protected]" />
<meta name="Robots" content="index,follow" />
<base href="http://localhost:8080/struts-blank/pages/viewchallan.jsp">
<link rel="stylesheet" href="images/Refresh.css" type="text/css" />
<title>PEW // View Challan</title>
<style type="text/css">
<!--
a:hover {
color: #003061;
}
h2 {
color: #044A92;
}
.style1 {
color: #555;
font-size: 150%;
}
-->
</style>
<script type="text/javascript">
var req;
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
function enableThis(checkedStr)
{
var par=checkedStr.parentNode;
while(par.nodeName.toLowerCase()!='tr')
{
par=par.parentNode;
}
qty = "qty"+ par.rowIndex;
pb = "pb"+ par.rowIndex;
nbl = "nbl"+ par.rowIndex;
dbl = "dbl"+ par.rowIndex;
bbs = "bbs"+ par.rowIndex;
document.getElementById(qty).disabled = !(checkedStr.checked);
document.getElementById(pb).disabled = !(checkedStr.checked);
document.getElementById(nbl).disabled = !(checkedStr.checked);
document.getElementById(dbl).disabled = !(checkedStr.checked);
document.getElementById(bbs).disabled = !(checkedStr.checked);
}
function submitForm()
{
document.forms[0].submit();
}
function calcBBSeries(value)
{
var par=value.parentNode;
while(par.nodeName.toLowerCase()!='tr')
{
par=par.parentNode;
}
var iIndex = par.rowIndex;
alert(iIndex)
document.forms[0].iRowNumber.value = iIndex;
alert(document.forms[0].iRowNumber.value)
//document.forms[0].action = "http://localhost:8080/struts-blank/challan.do?method=calcBBSeries";
document.forms[0].action = "http://localhost:8080/struts-blank/challan.do?method=calcBBSeries&rowNumber ="+ iIndex;
document.forms[0].submit();
}
</script>
</head>
<body>
<!-- wrap starts here -->
<div id="wrap"><!--header -->
<div id="header">
<div align="left" class="float-left"></div>
<div align="center"></div>
</div>
<!-- menu -->
<div id="menu">
</div>
<!-- content-wrap starts here -->
<div id="content-wrap">
<div id="sidebar">
<h1>Challans / Invoices</h1>
<div class="left-box">
</div>
<h1>Customers / P.O.</h1>
<div id="sidebar2">
<h1>Print Carton Labels</h1>
<div class="left-box"></div>
</div>
</div>
<div id="main">
<blockquote>
<h2 class="style1">Challan Entry</h2>
</blockquote>
<form name="ViewChallanForm" method="post" action="/struts-blank/challan.do?method=getProducts">
<table border="0"
>
<tr>
<td ><label>Challan No:</label></td>
<td >1</td>
<td ><label> Date:</label></td>
<td></td>
</tr>
<tr>
<td ><label> Customer Name:</label></td>
<td >Air India Ltd.</td>
<td ><label> A.R.E. No:</label></td>
<td>1</td>
</tr>
<tr>
<td><label>PONO:</label></td>
<td>40008274</td>
<td><label>Last Box No.:</label></td>
<td>0</td>
</tr>
</table>
<table border="0"
>
<tr>
<input type="hidden" name="iRowNumber" value="0">
<td >
<div><strong>S/No.</strong></div>
</td>
<td ><strong> Products</strong></td>
<td ><strong>Quantity </strong></td>
<td>
<div><strong>Per box</strong></div>
</td>
<td >
<div><strong>Nos. of B/L</strong></div>
</td>
<td >
<div><strong>Boxes/Loose </strong></div>
</td>
<td>
<div><strong>BB Series</strong></div>
</td>
</tr>
<tr>
<td>1.</td>
<td><input type="checkbox" name="checkedProducts" value="nos." onclick="enableThis(this);" id="multi_box"> ATLAS Drawer</td>
<td><input type="text" name="quantity" size="6" value="50" disabled="disabled" id="qty1"></td>
<td>
<input type="text" name="perbox" size="5" value="0" onchange="calcBBSeries(this);" disabled="disabled" id="pb1"></td>
<td><input type="text" name="nos_BL" size="5" value="0" disabled="disabled" id="nbl1"></td>
<td><select name="BL" disabled="disabled" id="dbl1"><option value="Select" selected="selected">Select</option>
<option value="Boxes">Boxes</option>
<option value="Loose">Loose</option></select></td>
<td><input type="text" name="bbSeries" size="7" value="-" disabled="disabled" id="bbs1"></td>
</tr>
<tr>
<td>2.</td>
<td><input type="checkbox" name="checkedProducts" value="nos." onclick="enableThis(this);" id="multi_box"> Standard Units</td>
<td><input type="text" name="quantity" size="6" value="70" disabled="disabled" id="qty2"></td>
<td>
<input type="text" name="perbox" size="5" value="0" onchange="calcBBSeries(this);" disabled="disabled" id="pb2"></td>
<td><input type="text" name="nos_BL" size="5" value="0" disabled="disabled" id="nbl2"></td>
<td><select name="BL" disabled="disabled" id="dbl2"><option value="Select" selected="selected">Select</option>
<option value="Boxes">Boxes</option>
<option value="Loose">Loose</option></select></td>
<td><input type="text" name="bbSeries" size="7" value="-" disabled="disabled" id="bbs2"></td>
</tr>
<tr>
<td>3.</td>
<td><input type="checkbox" name="checkedProducts" value="nos." onclick="enableThis(this);" id="multi_box"> ATLAS Oven Cage</td>
<td><input type="text" name="quantity" size="6" value="80" disabled="disabled" id="qty3"></td>
<td>
<input type="text" name="perbox" size="5" value="0" onchange="calcBBSeries(this);" disabled="disabled" id="pb3"></td>
<td><input type="text" name="nos_BL" size="5" value="0" disabled="disabled" id="nbl3"></td>
<td><select name="BL" disabled="disabled" id="dbl3"><option value="Select" selected="selected">Select</option>
<option value="Boxes">Boxes</option>
<option value="Loose">Loose</option></select></td>
<td><input type="text" name="bbSeries" size="7" value="-" disabled="disabled" id="bbs3"></td>
</tr>
<tr>
<td>4.</td>
<td><input type="checkbox" name="checkedProducts" value="kg" onclick="enableThis(this);" id="multi_box"> ATLAS Oven Tray</td>
<td><input type="text" name="quantity" size="6" value="100" disabled="disabled" id="qty4"></td>
<td>
<input type="text" name="perbox" size="5" value="0" onchange="calcBBSeries(this);" disabled="disabled" id="pb4"></td>
<td><input type="text" name="nos_BL" size="5" value="0" disabled="disabled" id="nbl4"></td>
<td><select name="BL" disabled="disabled" id="dbl4"><option value="Select" selected="selected">Select</option>
<option value="Boxes">Boxes</option>
<option value="Loose">Loose</option></select></td>
<td><input type="text" name="bbSeries" size="7" value="-" disabled="disabled" id="bbs4"></td>
</tr>
</table>
</form>
<div align="right"><input type="button" name="" value="Save"></div>
<div align="center"></div>
</div>
<!-- content-wrap ends here --></div>
<!--footer starts here-->
<div id="footer">
</div>
<!-- wrap ends here --></div>
</body>
</html>