hi,
im my jsp page..i had to enter amount.it is getting validated for nos.But the problem with decimal point...can any one help me..here is the code..
login.jsp
login.js
thanks in advance,
madhu.
im my jsp page..i had to enter amount.it is getting validated for nos.But the problem with decimal point...can any one help me..here is the code..
login.jsp
Code:
<s:textfield name="Cost" id="uploadtextContCost" label="Cost "/>
Code:
if (form.Cost.value == "")
{
alert("Enter Content Cost");
form.Cost.focus();
return (false);
}
var CostValid = document.getElementById('uploadtextContCost').value;
for(var i = 0; i < CostValid.length; i++)
{
currentCode = CostValid.charCodeAt(i);
if(currentCode!=45 && currentCode!=46 && currentCode<48 || currentCode>57)
{
alert('Only Numbers are allowed in Content Cost');
return false;
}
currentCode1 = Math.abs(CostValid);
if (CostValid != Math.abs(CostValid))
{
alert('U had Entered -ve value in Content Cost');
CostValid = Math.abs(CostValid);
return false;
}
}
madhu.
Comment