1.0.10 • Published 2 years ago

@domoskanonos/nidoca-form-helper v1.0.10

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

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
npmPublished on npm Published on npm Published on npm Published on npm Published on npm
githubPublished on git
donationdonate

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";
}
1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.0

3 years ago