Skip to content

Commit

Permalink
Merge pull request #10 from global-source/dev
Browse files Browse the repository at this point in the history
Dynamic DOM handling [ES6 and Native]
  • Loading branch information
shankarThiyagaraajan authored May 3, 2017
2 parents 41bcd31 + 796d27c commit 0f8b23f
Show file tree
Hide file tree
Showing 3 changed files with 41 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
16 changes: 16 additions & 0 deletions src/js/validatorNew.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,14 @@ var jsValidator = {
forceFilter: false,
// To Filter the First load.
initialLoad: true,
// Global options.
option: false,
// Initiating the Validator.
init: function (option) {
jsLogger.table(option);

// To Update global options.
this.option = option;
// Updating the filter flag to global.
this.onlyFilter = option.onlyFilter;
// Update "jsSettings" to global object.
Expand Down Expand Up @@ -78,6 +82,18 @@ var jsValidator = {
});
}
},
// To Refresh the DOM and enable Dynamic-Elements to Access.
update: function () {
var option = this.option;
// Updating the filter flag to global.
this.onlyFilter = option.onlyFilter;
// Update "jsSettings" to global object.
this.jsSettings = jsSettings.init(option);
// Update "jsForm" to global object.
this.jsForm = jsForm.init(option);
// Initiate form error setup.
this.jsFormError = jsFormError.init();
},
// To checking all elements from registered form.
check: function () {
var status = false;
Expand Down

0 comments on commit 0f8b23f

Please sign in to comment.