aris1234 Posted June 9, 2007 Share Posted June 9, 2007 Hi.. i have field in record using type : numeric, how to make validation and i want viewing messagebox if user inputing character or empty? this code just work for empty field, not for numeric type, if(WithoutContent(document.add.sprice.value)) { errormessage += "\n\n\"PRICE\" still Empty."; } ---------- this my full code: Code: ( html4strict ) 1. <script type="text/javascript" language="JavaScript"> 2. <!-- 3. function CheckValidation() { 4. var errormessage = new String(); 5. 6. if(WithoutContent(document.add.sprice.value)) 7. { errormessage += "\n\n\"PRICE\" still Empty."; } 8. if(WithoutContent(document.add.spropadd.value)) 9. { errormessage += "\n\nPROPERTY ADD still Empty."; } 10. if(WithoutSelectionValue(document.add.sbed)) 11. { errormessage += "\n\nBED list still Empty."; } 12. 13. if(errormessage.length > 2 ) 14. { 15. alert('NOTE:' + errormessage); 16. return false; 17. } 18. return true; 19. 20. function WithoutContent(ss) { 21. if(ss.length > 0) { return false; } 22. return true; 23. } 24. 25. function WithoutSelectionValue(ss) { 26. for(var i = 0; i < ss.length; i++) { 27. if(ss.selected) { 28. if(ss.value.length) { return false; } 29. } 30. } 31. return true; 32. } 33. //--> 34. </script> 35. . 36. . 37. . 38. <form name="add" onsubmit="return CheckValidation()" action="inputing.php" method="POST" enctype="multipart/form-data"> that code only to blank or empty field.. how to validation for price (numeric type) in code above ?? thank b4. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.