Skip to content

Adds javascript support to compose object by deep form structure. The method dataform() uses javascript to serializes a form into a JavaScript Object. With this library you can also specific types to mutate data, appending the type with a colon.

License

Notifications You must be signed in to change notification settings

marcusyoda/js-dataform

Repository files navigation

js-dataform

Adds javascript support to compose object by deep form structure. The method dataform() uses javascript to serializes a form into a JavaScript Object. With this library you can also specific types to mutate data, appending the type with a colon.

GitHub package.json version GitHub Repo stars GitHub issues

WHO SHOULD USE:

Recommended for all those who want to collect and structure data from an HTML form.

GETTING STARTED:

You need to include in HTML file! Use script with CDN src:

//include lib
<script type="text/javascript" src="//cdn.jsdelivr.net/gh/maviniciuus/dist/jsdataform.min.js"></script>

Your javascript code look likes this:

<script>
//get form by id
var my_form = document.getElementById('my_form');

//function to handle submit and get form data to print at console
function handle_submit(event) {
  var myform_data = dataform.parse(event.target);

  //@TODO make awesome things with form data
  console.log(myform_data);
}

// add listener to handle form submit event
document.getElementById("my_form").addEventListener("submit", handle_submit);
</script>

DOC:

Everything you need to know about dataform you find HERE. Something is missing? Open an issue right now...

LOOKING FOR SAMPLES:

Clone de repo and look samples folder. I did two samples, basic_html and bootstrap;

DEPENDENDENCIES:

  • Proudly, with 3Kb, running with no dependencies.

LICENSE:

Developed by Marcus Vinícius Mendes Gonçalves, during javascript research and study.

About

Adds javascript support to compose object by deep form structure. The method dataform() uses javascript to serializes a form into a JavaScript Object. With this library you can also specific types to mutate data, appending the type with a colon.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published