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]
# 1
did you see any errors?
jgalacambraa at 2007-7-13 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 2

<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

mela at 2007-7-13 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 3

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;

}

jgalacambraa at 2007-7-13 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 4
hi jgalacambra , i dont get your meaning and do u know what is the correct code to do so. because i need to call function from class filecalPect = pc.calcQtyPect(qty,laqty);plz help..thx
mela at 2007-7-13 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 5
you can call a function from a class file only every loading of page.. if yu will have to compute for a value.. you can use javascript to do so.
jgalacambraa at 2007-7-13 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 6
oic.. i get your meaning already..thx for your help.
mela at 2007-7-13 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 7
anyway.. there is a workaround if you will need to compute on the server side.. you can use ajax so you won't have to submit the whole page.. just the partially needed value..
jgalacambraa at 2007-7-13 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 8
ya..ajax. i just found out. so i have to look through ajax before i can perform my task.
mela at 2007-7-13 > top of java,Enterprise & Remote Computing,Web Tier APIs...