Skip to content

Commit

Permalink
- Dynamic Element Access (ES6) Implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
shankarThiyagaraajan committed May 3, 2017
1 parent e654f26 commit 796d27c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/demo/index2.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</div>
<div>
<label></label>
<input type="text" data-allow="onlyAlpha" name="name2">
<input type="text" data-allow="onlyAlpha" name="name2" required>
</div>
<div>
<label></label>
Expand All @@ -25,20 +25,20 @@
</div>
</form>

<script src="./../js/validatorNew.js"></script>
<!--<script src="./../js/validatorNew.es6.js"></script>-->
<!--<script src="./../js/validatorNew.js"></script>-->
<script src="./../js/validatorNew.es6.js"></script>
<script>

// var form = new jsValidator().init({
// form: 'form2submit',
// forceFilter: true
// });

var form = jsValidator.init({
var form = new jsValidator().init({
form: 'form2submit',
forceFilter: true
});

// var form = jsValidator.init({
// form: 'form2submit',
// forceFilter: true
// });

</script>
</body>
</html>
16 changes: 16 additions & 0 deletions src/js/validatorNew.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class jsValidator {
this.forceFilter = false;
// To Filter the First load.
this.initialLoad = true;
// Global options.
this.option = false;
}

// Initiating the Validator.
Expand All @@ -53,6 +55,8 @@ class jsValidator {

jsLogger.table(option);

// To Update global options.
this.option = option;
// Update "jsSettings" to global object.
this.jsSettings = new jsSettings().init(option);
// Update "jsForm" to global object.
Expand Down Expand Up @@ -85,6 +89,18 @@ class jsValidator {
}
}

// To update the DOM to make action listener.
update() {
// To Update global options.
let option = this.option;
// Update "jsSettings" to global object.
this.jsSettings = new jsSettings().init(option);
// Update "jsForm" to global object.
this.jsForm = new jsForm().init(option);
// Initiate form error setup.
this.jsFormError = new jsFormError().init();
}

// To checking all elements from registered form.
check() {
// Loading JS Form.
Expand Down

0 comments on commit 796d27c

Please sign in to comment.