Skip to content

Commit

Permalink
[behavior.formvalidator] - pattern attribute behaviour fix (#19771)
Browse files Browse the repository at this point in the history
* [behavior.formvalidator] - pattern behaviour fix

* minify
  • Loading branch information
alikon authored and Michael Babker committed Mar 17, 2018
1 parent 9d927c1 commit 3e436e0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
19 changes: 11 additions & 8 deletions media/system/js/validate-uncompressed.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,17 @@ var JFormValidator = function() {

// Try HTML5 pattern first then the handlers
if ($el.attr('pattern') && $el.attr('pattern') != '') {
if ($el.val().length) {
isValid = new RegExp('^'+$el.attr('pattern')+'$').test($el.val());
handleResponse(isValid, $el);
return isValid;
} else {
handleResponse(false, $el);
return false;
}
if ($el.val().length) {
isValid = new RegExp('^'+$el.attr('pattern')+'$').test($el.val());
handleResponse(isValid, $el);
return isValid;
}
if ($el.attr('required') || $el.hasClass('required')) {
handleResponse(false, $el);
return false;
}
handleResponse(true, $el);
return true;
} else {
if (handler === '') {
handleResponse(true, $el);
Expand Down
2 changes: 1 addition & 1 deletion media/system/js/validate.js

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

0 comments on commit 3e436e0

Please sign in to comment.