I have a JSP which gets a value called sum from the DB...
String sum= request.getAttribute("s").toString();
int s = Integer.parseInt(sum);
I have a field in a form called weight who's value cannot exceed sum.
So on clicking submit i'm running a function called validate. Which would check if field is greater than or equal to sum but it keeps giving me the warning all the time.
<script type="text/javascript">
function validate()
{
var x= document.getElementById("s");
if(document.getElementById("weight").value>x)
{
alert("Weight exceeds maximum limit...!!!");
return false;
}
return true;
}
</script>
Would appreciate the help..