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
Expand|Select|Wrap|Line Numbers
- <s:textfield name="Cost" id="uploadtextContCost" label="Cost "/>
Expand|Select|Wrap|Line Numbers
- 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.