I was really stuck with this one and so when I found out a solution , I thought of posting it.
Now , when you have to read the value from a text box in a form in jsp using a java script , what you get is the first value , i.e
consider a form called to_delivery and consider a text field value in it called to_dispatch, now to get the value of to_dispatch in a java script you use ,
qty = document.to_delivery.to_dispatch1.value;
The problem here is that it would give only the first number in the text feild, i.e if to_dispatch has a value of 78 , the variable qty will have only 7.
To fix this use the following code
qty = parseFloat(document.to_delivery.to_dispatch1.value);
The trick is using parseFloat or parseInt to get the correct value.
Now , when you have to read the value from a text box in a form in jsp using a java script , what you get is the first value , i.e
consider a form called to_delivery and consider a text field value in it called to_dispatch, now to get the value of to_dispatch in a java script you use ,
qty = document.to_delivery.to_dispatch1.value;
The problem here is that it would give only the first number in the text feild, i.e if to_dispatch has a value of 78 , the variable qty will have only 7.
To fix this use the following code
qty = parseFloat(document.to_delivery.to_dispatch1.value);
The trick is using parseFloat or parseInt to get the correct value.