Zoeken in deze blog

dinsdag 7 september 2010

Opmaak vast telefoonnummer wanneer land = Nederland

//OPMAAK TELEFOONNUMER BIJ LAND = NEDERLAND

PhonenumberFormat = function()
{
if(crmForm.all.cov_landid_ba.DataValue != null)
{
LookupItem = crmForm.all.cov_landid_ba.DataValue;
if(LookupItem[0].name == 'Nederland')
{
var formFld = event.srcElement;var TelNo = "";
if(formFld.DataValue != null)
{
TelNo = formFld.DataValue.replace(/[^[0-9]/g, "");
}
else
{
return;
}
if(TelNo.substr(0,2) == "31")
{
var TelNo = "0" + TelNo.substr(2);
}
if(TelNo.substr(0,4) == "0031")
{
var TelNo = "0" + TelNo.substr(4);
}
if(TelNo.length > 9)
{
switch (TelNo.substr(0,3))
{
case "010":
case "013":
case "015":
case "020":
case "023":
case "024":
case "026":
case "030":
case "033":
case "035":
case "036":
case "038":
case "040":
case "043":
case "045":
case "046":
case "050":
case "053":
case "055":
case "058":
case "070":
case "071":
case "072":
case "073":
case "074":
case "075":
case "076":
case "077":
case "078":
case "079":
case "085":
case "088":

formFld.DataValue = "(+31)" + " " + TelNo.substr(1,2) + " " + TelNo.substr(3,3) + " " + TelNo.substr(6,2) + " " + TelNo.substr(8,2);
break;

default:formFld.DataValue = "(+31)" + " " + TelNo.substr(1,3) + " " + TelNo.substr(4,2) + " " + TelNo.substr(6,2) + " " + TelNo.substr(8,TelNo.length-8);
break;
}
}
}
}
}

Geen opmerkingen:

Een reactie posten