Skip to content

Commit 2f6c195

Browse files
- Developer comments
1 parent 1234745 commit 2f6c195

File tree

3 files changed

+24
-14
lines changed

3 files changed

+24
-14
lines changed

src/demo/index2.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
var form = jsValidator.init({
3838
form: 'form2submit',
39-
forceFilter: false
39+
forceFilter: true
4040
});
4141

4242
</script>

src/js/validatorNew.es6.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ class jsFilter {
339339
if (false === regex.test(key) || parseInt(value) > max || parseInt(value) < min) {
340340
event.preventDefault();
341341
}
342+
// Updating the value.
342343
event.target.value = (event.target.value > max) ? max : event.target.value;
343344
}
344345

@@ -752,28 +753,32 @@ let pattern = {
752753
}
753754
};
754755

756+
/*
757+
* To Manage all kind of error response.
758+
*/
755759
let validationResponse = {
756760

761+
// Initiating the Response handler.
757762
init: function (errorList) {
758763
// let errorElements = option.errorElem;
759764
jsLogger.out('Errors', errorList);
760765
this.input(errorList.input);
761766
this.select(errorList.select);
762767
this.textArea(errorList.textArea);
763768
},
764-
769+
// To handle the "input" element.
765770
input: function (elem) {
766771
this.process(elem);
767772
},
768-
773+
// To handle the "select" element.
769774
select: function (elem) {
770775
this.process(elem);
771776
},
772-
777+
// To handle the "textArea" element.
773778
textArea: function (elem) {
774779
this.process(elem);
775780
},
776-
781+
// To process all handlers.
777782
process: function (elem) {
778783
for (let i in elem) {
779784
// jsLogger.out('Element', document.getElementById(elem[i].id));
@@ -791,13 +796,13 @@ let validationResponse = {
791796
jsLogger.out('Element Found', true);
792797
}
793798
jsLogger.out('Error Elem', activeElem.el);
799+
// Append HTML response to the Element.
794800
activeElem.el.parentNode.insertBefore(spanTag, activeElem.el.nextSibling);
795801
}
796802
}
797803
},
798-
804+
// Perform template creation and update.
799805
template: function () {
800806

801807
}
802-
803808
};

src/js/validatorNew.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -693,30 +693,35 @@ var pattern = {
693693
}
694694
};
695695

696+
697+
/*
698+
* To Manage all kind of error response.
699+
*/
696700
var validationResponse = {
697701

702+
// Initiating the Response handler.
698703
init: function (errorList) {
699704
// let errorElements = option.errorElem;
700705
jsLogger.out('Errors', errorList);
701706
this.input(errorList.input);
702707
this.select(errorList.select);
703708
this.textArea(errorList.textArea);
704709
},
705-
710+
// To handle the "input" element.
706711
input: function (elem) {
707712
this.process(elem);
708713
},
709-
714+
// To handle the "select" element.
710715
select: function (elem) {
711716
this.process(elem);
712717
},
713-
718+
// To handle the "textArea" element.
714719
textArea: function (elem) {
715720
this.process(elem);
716721
},
717-
722+
// To process all handlers.
718723
process: function (elem) {
719-
for (var i in elem) {
724+
for (let i in elem) {
720725
// jsLogger.out('Element', document.getElementById(elem[i].id));
721726
if (elem[i].el && true === elem[i].el.required) {
722727
var activeElem = elem[i];
@@ -732,13 +737,13 @@ var validationResponse = {
732737
jsLogger.out('Element Found', true);
733738
}
734739
jsLogger.out('Error Elem', activeElem.el);
740+
// Append HTML response to the Element.
735741
activeElem.el.parentNode.insertBefore(spanTag, activeElem.el.nextSibling);
736742
}
737743
}
738744
},
739-
745+
// Perform template creation and update.
740746
template: function () {
741747

742748
}
743-
744749
};

0 commit comments

Comments
 (0)