|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
can any1 look at it?
function IsNumeric(sText)
{ var ValidChars = "0123456789."; var IsNumber=true; var Char; alert("GHJHGH"); alert(sText); for (i = 0; i < sText.length && IsNumber == true; i++) { Char = sText.charAt(i); if (ValidChars.indexOf(Char) == -1) { alert("NUMBER!"); IsNumber = false; } } return IsNumber; } //--> <!-- function confirmation() { var answer = confirm("Are you sure you want to SAVE the form?") if (answer){ return true; } else{ return false; } } //--> <!-- Begin function checkrequired(which) { var pass=true; if (document.images) { for (i=0;i<which.length;i++) { var tempobj=which.elements[i]; if (tempobj.name.substring(0,8)=="required") { if (((tempobj.type=="text"||tempobj.type=="textarea")&& tempobj.value=='')||(tempobj.type.toString().charA t(0)=="s"&& tempobj.selectedIndex==0)) { pass=false; break; } } } } if (!pass) { shortFieldName=tempobj.name.substring(8,30).toUppe rCase(); alert("Please make sure the "+shortFieldName+" field was properly completed."); return false; } else { var isnum =true; if(tempobj.name.substring(0,13) == "requiredJOBNO"){ isnum = IsNumeric(which);} var answer = confirmation(); if(answer && isnum){ return true; } return false; } } // End --> </script> i use the onSubmit to call the checkrequired function tehn i will use the function to check if the fields have been entered by the user then i will go on to check if the jobno field is numeric... but then i have a prob... it dun seems to go into the isnumeric function and i am not sure how to work with the WHICH( as in how to get values out or the name...) can any1 pls help??? thks |
![]() |
| Viewing: ASP Free Forums > Programming > HTML, JavaScript And CSS Help > can any1 look at it? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|