PDA

View Full Version : Validation Script & Error Message Help



Jus S
07-29-2008, 01:53 PM
The inputs to the form below is supposed to be validated using the script below. If the user does not use all numbers, a message is supposed to appear next to the "validate" button saying "The input is not numeric." Can someone help me on this?

// <form id="form1" name="form1" action="#">
// <table align='center'>
/* <td><input name="numeric" id="numeric" validation="required" /><input type="submit" value=" Validate " onclick="IsNumeric();" /></td> */
// </table>
// </form>

// <script type="text/javascript">
// function IsNumeric(sText) {
// var ValidChars = "0123456789.";
// var IsNumber=true;
// var Char;
// for (i=0;i<sText.length && IsNumber == true; i++) {
// Char = sText.charAt(i);
// if (ValidChars.indexOf(Char) == -1) {
// IsNumber = false;
// }
// }
// return IsNumber;
// }
// </script>

Jus S
07-29-2008, 03:30 PM
Solved my problem.