function ValidPhoneControl(val) { // Get the child controls. var id = val.controltovalidate; var npa = document.getElementById(id+'.NPA'); var nxx = document.getElementById(id+'.NXX'); var suffix = document.getElementById(id+'.Suffix'); var ext = document.getElementById(id+'.Ext')||{}; // Get the event. var event = (arguments.callee && arguments.callee.caller && arguments.callee.caller.arguments && arguments.callee.caller.arguments.length>2 && arguments.callee.caller.arguments[2]) || {}; // Fix target property, if necessary if ( !event.target ) { event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either } // check if target is a textnode (safari) if ( event.target.nodeType === 3 ) { event.target = event.target.parentNode; } // Are we still focused on one of the first two textboxes? var focused = npa==event.target||nxx==event.target; // What's the current phone number? var phone = npa.value+ nxx.value+ suffix.value+ (ext.value||''); if (!phone) // This is not the same as a required field. val.isvalid = true; else if (focused && phone && /^\d+$/.test(phone)) // If the user is still typing the phone number, just make sure its digits only. val.isvalid = true; else // Otherwise, make sure the phone number was filled out correctly. val.isvalid = /^[2-9]\d{2}$/.test(npa.value) && /^[2-9]\d{2}$/.test(nxx.value) && /^\d{4}$/.test(suffix.value) && (!ext.value || /^\d+$/.test(ext.value)); return val.isvalid; }

Free Case Evaluation

Have Questions? Our Firm Has the Answers.

If you have questions regarding probate, wills, or trusts, your first step should be to get in touch with our Trust Attorney at Alpes Law Firm We offer a free case evaluation form so that you can quickly and easily let us know the details of your case. This confidential form will allow us to examine your unique situation and get back to you regarding how we could help you!

Please call +44 744 090 7767 or fill out the form below:

Phone:
--
Follow Us On
// //
if ( typeof $ !== 'undefined' && $.fn && $.fn.autoNumber ) { $('#ContactForm2_ctl01_Phone').autoNumber(); }