Jump to content

error with CHECKNUMBER function


sayedsohail

Recommended Posts

Hi,

 

I don't know where i am wrong, but this functions are not at all verifying the value

 

 

function  checkNumeric( strng ) 
{
var error = "";
  var passPattern = new RegExp("/(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/");

 if(!passPattern.test(strng))
 {
 	if(strng == "")
	{
		error += "Pleae neter the Phone and Mobile numbers.\n";
	}
	else if((strng.length < 11) || (strng.length > 12))
	{
		error += "The phone number is wrong lenght, it should be 01332600090.\n";
	}
	else
	{
		error += "The phone number contains illegal characters.\n";
	}
 }

 return error;

}


function checkEmpty(strng)
{
	var error = "";
   	var strTemp = strng;
   	strTemp = trimAll(strTemp);
   	if(strTemp.length < 1){
error += "Please enter company name.\n";
   }
return error;
}

Link to comment
https://forums.phpfreaks.com/topic/38813-error-with-checknumber-function/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.