Skip to content

Commit

Permalink
a bit more faster on save
Browse files Browse the repository at this point in the history
  • Loading branch information
Fedik committed Oct 2, 2014
1 parent 9e20ab2 commit 2dc424f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions media/system/js/validate-uncompressed.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var JFormValidator = function() {
if (!id) {
return false;
}

$label = $form.find('#' + id + '-lbl');
if ($label.length) {
return $label;
Expand All @@ -43,7 +44,7 @@ var JFormValidator = function() {
// Get a label
var $label = $el.data('label');
if($label === undefined){
$label = findLabel($el.attr('id'), $el.parents('form'));
$label = findLabel($el.attr('id'), $el.data('form'));
$el.data('label', $label);
}

Expand Down Expand Up @@ -98,7 +99,7 @@ var JFormValidator = function() {
}
// Return validation state
handleResponse(true, $el);
return true;
return false;
},

isValid = function(form) {
Expand Down Expand Up @@ -132,9 +133,10 @@ var JFormValidator = function() {
},

attachToForm = function(form) {
var inputFields = [];
var inputFields = []
$form = jQuery(form);
// Iterate through the form object and attach the validate method to all input fields.
jQuery(form).find('input, textarea, select, fieldset, button').each(function() {
$form.find('input, textarea, select, fieldset, button').each(function() {
var $el = $(this), id = $el.attr('id'), tagName = $el.prop("tagName").toLowerCase();
if ($el.hasClass('required')) {
$el.attr('aria-required', 'true').attr('required', 'required');
Expand All @@ -154,10 +156,11 @@ var JFormValidator = function() {
$el.get(0).type = 'email';
}
}
$el.data('form', $form)
inputFields.push($el);
}
});
$(form).data('inputfields', inputFields);
$form.data('inputfields', inputFields);
},

initialize = function() {
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 2dc424f

Please sign in to comment.