@domoskanonos/nidoca-form-helper
TypeScript icon, indicating that this package has built-in type declarations

1.0.10 • Public • Published

nidoca framework (nidoca-form-helper)

it's often tedious and time-consuming to read current values ​​from formular fields. this little helper class will help you get the job done. it finds all form elements (input, select, textarea, button), automatically reads out the current values and returned the corresponding model object.

project info
npm Published on npm Published on npm Published on npm Published on npm Published on npm
github Published on git
donation donate

usage

install npm

npm i @domoskanonos/nidoca-form-helper

let's assume, you have an html formular with several input fields and want to read out the current values:

<form id="myForm">
    <input type="test" name="myText" value="myTextValue" />
    <select name="mySelect">
        <option value="myOptionValue" selected>my option value</option>
    </select>
    <textarea name="myTextarea">myTextareaValue</textarea>
    <button name="myButton" value="myButtonValue"></button>
</form>

code

typescript model class
//corresponding form model class
class Test {
    myText: string | undefined;
    myTextarea: string | undefined;
    myButton: string | undefined;
    mySelect: string | undefined;
}
get current values from formular elements as test object instance
// get values from form element
const formElement = document.getElementById("myForm");
const nidocaHelperForm: NidocaHelperForm<Test> = new NidocaHelperForm();
const model: Test = nidocaHelperForm.getCurrent(formElement);
current test object value
{
    myText: "myTextValue";
    myTextarea: "myTextareaValue;
    myButton: "myButtonValue";
    mySelect: "mySelectValue";
}

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.10
    1
    • latest

Version History

Package Sidebar

Install

npm i @domoskanonos/nidoca-form-helper

Weekly Downloads

10

Version

1.0.10

License

MIT

Unpacked Size

21.7 kB

Total Files

16

Last publish

Collaborators

  • domoskanonos