this.formValidator = {
// Defines the validation rules
rules: {
'name': {
required: [true, '* Enter your name']
},
'email': { required: true, email: true }
//'email': { required: [true, "* Enter your email address"], email: [true, '* Enter valid Email'] } custom error message
}
};
this.formObject = new FormValidator('#formTemp', this.formValidator);
this.formObject.customPlacement = function (element, errorElement) {
element.parentNode.parentNode.appendChild(errorElement);
};
onSubmitClick(event) {
event.preventDefault();
this.formObject.validate();
} |