0

Hi,

Code below returns true for (.). It should return false like it returns false for (,). Is there any other way to check (.) and (,). I simply want validate money.

Thanks

if (isNaN(form1.paid.value)) {
   alert ("Syntax is not right.");
   return false;		
}
return true;
3
Contributors
5
Replies
6
Views
8 Years
Discussion Span
Last Post by veledrom
0

The pattern I posted will only return true for a dot if it has one or more numeric digits after it. Make sure you're actually trying what I posted.

0
<script type="text/javascript">
<!--Begin Hiding
function validateForm(form) 
{ 
form = (form.paid.value.indexOf('.') == -1 || form.paid.value.indexOf(',') > 0 ) ?
alert('\nInvalid entry!\nPlease try again...') : alert('Thank you!');
} 
/* This will validate your form if the user include any of this (',') or exclude one of this ('.') he/she wil be alerted with invalid entry! Hope this one helps you...*///Enjoy-->
// Done Hiding -->
</script>
0

I solved with checking all the characters bit by bit in textbox, if they are numeric or not.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.