This is a client-side form input control and validation library. Built in typescript and compiled with tsc and rollup. The idea behind this library is to make input control and validation as native as possible for developers utilizing as many native HTML attributes as possible.
To get started with formSubmit, follow these steps:
- Clone the repository:
git clone https://github.com/sbcguard/formSubmit.git
- Make any necessary type attribute changes.
- Rebuild with:
npm run build
- Utilize the csj, esm, or umd modules at a page level by placing a script tag in the head tag of the page.
<script type="text/javascript" src="path/to/formSubmit.js"></script>
Alternately, you can use the prebuilt versions provided in the '/dist' folder of the repository.
formSubmit.js will key off of native HTML 'type' attribute to apply controls on page load, the HTML required attribute to require non-null (blank) input. For non-native type, apply the 'data-type' dataset attribute to the element to use a custom defined type.
Attached to the window object are 3 methods:
- window.isValid() - Pass in any html input element to check its validity.
- window.checkAllValidity() - Check the validity of all inputs on all forms present on the page and returns the results to the console.
- window.reinitialize() - Resets form submit. This is for use when the DOM has been programmatically changed and needs to be re-applied.
Simple Markdown Editor is MIT licensed.