dom-form-submit

0.0.7 • Public • Published

DOM-Form-Submit

Utility build or use form and submit using provided data. This library will intelligently reuse the same form and perform minimal manipulations for optimum performance.

Build Status

NPM

Installation

Npm

npm install dom-form-submit

Example

var submit = require('dom-form-submit');
 
// Submit form with data (create or use existing form) with callback to run after submit
submit(
    {a: 'b', c: 'd'},
    {id: 'my-form-id', name: 'my-form-name'},
    function(submittedForm) {}      // callback with form element
);
 
// Submit an existing form.
submit({a: 'b', c: 'd'}, {
    method: 'POST',
    form: document.getElementById('my-form')
});
 
// Basically empty form submit
submit();
 

API Options / Defaults.

{
    method: 'GET',
    enctype: 'application/x-www-form-urlencoded',
    target: '_self'
}

Please feel free to create a PR!

Thanks to

https://github.com/gillstrom/submitform

https://github.com/DylanPiercey/submit-form

Dependencies (0)

    Dev Dependencies (3)

    Package Sidebar

    Install

    npm i dom-form-submit

    Weekly Downloads

    23

    Version

    0.0.7

    License

    MIT

    Last publish

    Collaborators

    • hasnat