Skip to content

swim/mithril-form

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mithril.form

Provides a Mithril based form constructor with managed submit and validation handlers.

This component takes a different tact from other (mithril based) form examples I have seen. Instead of binding to the onChange event we simply wait for the user to trigger the submit handler and then act. However one could easily pass additional attributes to each form element;

var textForm = {
  attributes: {
  	class: 'form',
  	config: animation.fadeIn
  },
  elements: [
    {
      type: 'text',
      title: 'Text input',
      attributes: {
        name: 'submit_key',
        config: animation.fadeIn
      }
    }
  ],
  validate: function(form, values) {
    var valid = {
      status: true,
      message: ''
    }

    return valid;
  },
  submit: function(form, values) {  

  }
}

About

Provides a Mithril based form constructor (builder) with managed submit and validation handlers.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published