Notifications
Announcements
No record found.
Hello
Validate the Website Url field using javascript in dynamics crm. How can i implement this one validation
Can u please help me.
Thank you
Hi,
add this function to OnChange Event of field:
function OnChangeWebSite() { var webSite = Xrm.Page.getAttribute("webSite"); if (webSite.getValue() != null) { if (!validURL(webSite.getValue())) { alert("Please Insert a Valid URL!"); } } } function validURL(str) { var pattern = new RegExp('^(https?:\\/\\/)?' // protocol '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.) [a-z]{2,}|' // domain name '((\\d{1,3}\\.){3}\\d{1,3}))' // OR ip (v4) address '(\\:\\d )?(\\/[-a-z\\d%_.~ ]*)*' // port and path '(\\?[;&a-z\\d%_.~ =-]*)?' // query string '(\\#[-a-z\\d_]*)?$', 'i'); // fragment locator return !!pattern.test(str); }
Best Regards.
Thank you Mehran.
Very nice update. It is very useful to me.
Your code output displays like this: https://test.in
I need like this format :https://www.test.in
Can u pls help me
ok, use this:
function validURL(str) { var pattern = new RegExp(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._\ ~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\ .~#?&\/\/=]*); return !!pattern.test(str); }
Regards.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Tom_Gioielli 170 Super User 2025 Season 2
#ManoVerse 61
Gerardo RenterÃa Ga... 52 Most Valuable Professional