plz help me verify this... calling function
<jsp:useBean id ="pc" class="common.claim" scope="request" />
<script language="javascript">
function chkQty(x)
{
if(eval("document.breakdown.b_progQty"+x+".value") =='')
{
alert("The progress to date quantity do not have value.");
eval("document.breakdown.b_progQty"+x).focus();
}
else
if(eval("document.breakdown.b_progQty"+x+".value") < qty)
{
alert("The entered value for progress to date quantity is less then previous value.");
eval("document.breakdown.b_progQty"+x).value = qty;
eval("document.breakdown.b_progQty"+x).focus();
}
else
calcQtyPect(x);
}
function calcQtyPect(p)
{
<%
qty = request.getParameter("b_progQty"+p);
laqty = request.getParameter("b_laQty"+p);
calPect = pc.calcQtyPect(qty,laqty);
%>
eval("document.breakdown.b_progPect"+p).value = calPect;
}
</script>
<input type="text" size=8 name="b_progQty<%=c%>" id="progLump" value='<%=b_progQty.elementAt(c)%>' style="text-align:right;background:#ffffcc" onChange="chkQty(<%=c%>);">
plz help me to verify the above coding whether correct or not.
thx.
[2204 byte] By [
mela] at [2007-9-24]

<jsp:useBean id = "pc" class="common.claim" scope="request" />
<script language="javascript">
function chkQty(x)
{
if(eval("document.breakdown.b_progQty"+x+".value") == '')
{
alert("The progress to date quantity do not have value.");
eval("document.breakdown.b_progQty"+x).focus();
}
else
if(eval("document.breakdown.b_progQty"+x+".value") < qty)
{
alert("The entered value for progress to date quantity is less then previous value.");
eval("document.breakdown.b_progQty"+x).value = qty;
eval("document.breakdown.b_progQty"+x).focus();
}
else
calcQtyPect(x);
}
function calcQtyPect(p)
{
<%
qty = request.getParameter("b_progQty"+p);
laqty = request.getParameter("b_laQty"+p);
calPect = pc.calcQtyPect(qty,laqty);
%>
eval("document.breakdown.b_progPect"+p).value = calPect;
}
</script>
<html>
<body>
<%for(int c=0; c<b_block.size(); c++){%>
<input type="text" size=8 name="b_progQty<%=c%>" id="progLump" value='<%=b_progQty.elementAt(c)%>' style="text-align:right;background:#ffffcc" onChange="chkQty(<%=c%>);">
<%}%>
</body>
</html>
the most important that i wan to know is when changing data in the textbox then perform onChange="chkQty(<%=c%>);"
then will perform the function call. haha thx
the scriplet part of this function once loaded it will never change unless you will reload the page:
function calcQtyPect(p)
{
<%
qty = request.getParameter("b_progQty"+p);
laqty = request.getParameter("b_laQty"+p);
calPect = pc.calcQtyPect(qty,laqty);
%>
eval("document.breakdown.b_progPect"+p).value = calPect;
}