1.0.8 • Published 6 years ago
hem.js v1.0.8
#HEM - HTML Element Manager
Simple script to create invalid-feedback tag (bootstrap) when form is invalid and has set HTMLInputElement with
- require
- MaxLength
- MinLength
- Pattern
- Type
when user input valid value to HTMLInputElement it will remove invalid-feedback automaticly
All you have to do is 1. Create Web Form 2. Specified validation rule follow HTML5 standard 3. Write javascript to setup those elelemnt to HEM
import { HEMInputElement, HEMFormElement, HEMCompareInputElement } from "HEM"
export class Register {
constructor() {
this.SetupForms();
}
SetupForms() {
let inputFirstname = new HEMInputElement("inputFirstname");
let inputLastname = new HEMInputElement("inputLastname");
let inputMobile = new HEMInputElement("inputMobile");
let inputCardNo = new HEMInputElement("inputCardNo");
let inputUsername = new HEMInputElement("inputUsername");
let inputEmail = new HEMInputElement("inputEmail");
let inputPassword = new HEMInputElement("inputPassword");
let inputRePassword = new HEMInputElement("inputRePassword");
let comparePasswordAndRePassword = new HEMCompareInputElement("inputRePassword", "inputPassword");
inputEmail.TypeMissmatchFeedbackMessage = "Invalid Email Format";
comparePasswordAndRePassword.MissmatchFeedbackMessage = "Password unmatch";
let formRegister = new HEMFormElement("formRegister");
formRegister.AddFormElement(inputFirstname);
formRegister.AddFormElement(inputLastname);
formRegister.AddFormElement(inputMobile);
formRegister.AddFormElement(inputCardNo);
formRegister.AddFormElement(inputUsername);
formRegister.AddFormElement(inputEmail);
formRegister.AddFormElement(inputPassword);
formRegister.AddFormElement(inputRePassword);
formRegister.AddFormElement(comparePasswordAndRePassword);
formRegister.Submit().subscribe(this.Submit.bind(this));
}
Submit(isFormValid) {
console.log("isFormValid", isFormValid);
}
}
(() => {
new Register();
})();
#Release Log
- 1.0.0 - Initial
- 1.0.1 - Fix wording in sample code by remove Thai charactors
- 1.0.2 - Fix Release log line in readme.md
- 1.0.3 - Point main to dist/index.js
- 1.0.4 - Create index.d.ts file
- 1.0.5 - Create index.js file
- 1.0.5 - Add rxjs to dependency section in package.json