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:
Expand|Select|Wrap|Line Numbers
- <script type="text/javascript" language="JavaScript">
- <!--
- function CheckValidation() {
- var errormessage = new String();
- if(WithoutContent(document.add.sprice.value))
- { errormessage += "\n\n\"PRICE\" still Empty."; }
- if(WithoutContent(document.add.spropadd.value))
- { errormessage += "\n\nPROPERTY ADD still Empty."; }
- if(WithoutSelectionValue(document.add.sbed))
- { errormessage += "\n\nBED list still Empty."; }
- if(errormessage.length > 2) {
- alert('NOTE:' + errormessage);
- return false;
- }
- return true;
- function WithoutContent(ss) {
- if(ss.length > 0) { return false; }
- return true;
- }
- function WithoutSelectionValue(ss) {
- for(var i = 0; i < ss.length; i++) {
- if(ss[i].selected) {
- if(ss[i].value.length) { return false; }
- }
- }
- return true;
- }
- //-->
- </script>
- .
- .
- .
- <form name="add" onsubmit="return CheckValidation()" action="inputing.php" method="POST" enctype="multipart/form-data">
thanks b4..