Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

Regular Expression for URL by javascript in CRM 2016

$
0
0

Hi All,

I'm trying to apply regular exp. for URL which should accept normal standard 

but it is not happening 

here is the code :

function URLtest() {
//var alertreq = false;
var testres = true;

var URLvali = "/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/";
var name = Xrm.Page.getAttribute("new_websiteurl").getValue();//nameeld where u want to check the special character
for (var i = 0; i < name.length; i++) {
if (URLvali.indexOf(name.charAt(i)) != -1) {
testres = false;

}
}

if (testres == false) {
Xrm.Page.getControl("new_websiteurl").setNotification("Website formate should be in correct format");

}
else {
Xrm.Page.getControl("new_websiteurl").clearNotification();
}

}

Plz let me know if any changes required coz it is throwing error for correct format also.


Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>