Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 017648d

Browse files
author
vikasrohit
committed
SUP-2790, Weblink regular expression:--Able to add "http://aa" as a weblink
SUP-2791, Weblink-->Not able to add domain.com as web link -- Fixed URL pattern. Used from ASP code.
1 parent 6b52c4d commit 017648d

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

app/directives/external-account/external-web-link.directive.jade

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
.web-link
22
form(name="addWebLinkFrm", ng-submit="addWebLinkFrm.$valid && addWebLink()", autocomplete="off")
33
.validation-bar.url(ng-class="{ 'error-bar': (addWebLinkFrm.url.$dirty && addWebLinkFrm.url.$invalid) }")
4-
input.form-field.url(name="url", type="url", ng-model="url", placeholder="http://www.yourlink.com", required)
4+
input.form-field.url(name="url", type="text", ng-pattern="urlRegEx" ng-model="url", placeholder="http://www.yourlink.com", required)
55

66
.form-input-error(ng-show="addWebLinkFrm.url.$dirty && addWebLinkFrm.url.$invalid")
77
p(ng-show="addWebLinkFrm.url.$error.required") This is a required field.
88

9-
p(ng-show="addWebLinkFrm.url.$error.url") Please enter a valid URL
9+
p(ng-show="addWebLinkFrm.url.$error.pattern") Please enter a valid URL
1010

1111
button.tc-btn.tc-btn-m(type="submit",
1212
tc-busy-button, tc-busy-when="addingWebLink", tc-busy-message="Adding",

app/directives/external-account/external-web-links.directive.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
$log = $log.getInstance('ExternalWebLinkCtrl');
2727
$scope.addingWebLink = false;
2828
$scope.errorMessage = null;
29+
$scope.urlRegEx = /^(http(s?):\/\/)?(www\.)?[a-zA-Z0-9\.\-\_]+(\.[a-zA-Z]{2,3})+(\/[a-zA-Z0-9\_\-\s\.\/\?\%\#\&\=]*)?$/;
2930

3031
$scope.addWebLink = function() {
3132
$log.debug("URL: " + $scope.url);

0 commit comments

Comments
 (0)