Skip to content

Commit

Permalink
make form invalid even when no required attribute is present but some…
Browse files Browse the repository at this point in the history
…thing is entered into input
  • Loading branch information
prayagverma committed Jul 10, 2015
1 parent bca4d38 commit 2f7a74b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
10 changes: 9 additions & 1 deletion releases/international-phone-number.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,15 @@
return element.intlTelInput("isValidNumber");
}
} else {
return true;
if (element.intlTelInput("getSelectedCountryData").dialCode === value) {
return true;
} else {
if (!value) {
return true;
} else {
return element.intlTelInput("isValidNumber");
}
}
}
};
element.on('blur keyup change', function(event) {
Expand Down
2 changes: 1 addition & 1 deletion releases/international-phone-number.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion src/international-phone-number.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,13 @@ angular.module("internationalPhoneNumber", []).directive 'internationalPhoneNumb
else
return element.intlTelInput("isValidNumber")
else
return true
if element.intlTelInput("getSelectedCountryData").dialCode == value
return true
else
if !value
return true
else
return element.intlTelInput("isValidNumber")


element.on 'blur keyup change', (event) ->
Expand Down

0 comments on commit 2f7a74b

Please sign in to comment.