{"_id":"reformer","_rev":"41-525b81ab6183950f40df2745bc3feb55","name":"reformer","description":"Super customizable, Self-contained, self-rendering, self-validating forms that can only output valid data.","dist-tags":{"latest":"1.4.2"},"versions":{"0.0.1":{"name":"reformer","version":"0.0.1","author":{"name":"Henrik Joreteg","email":"henrik@andyet.net"},"description":"Self-contained, self-rendering, self-validating forms that can only output valid data.","dependencies":{"jade":"","uglify-js":"","underscore":"","colors":"","yetify":""},"repository":{"type":"git","url":"https://github.com/HenrikJoreteg/reformer.git"},"keywords":["form","browser","jade"],"main":"reformer.js","readme":"#reformer\n\nSelf-contained, self-rendering, self-validating forms that can only output valid data.\n\n##Step #1: Define your fields, with as many tests as you want for each field:\n\n```javascript\nvar f = new Reformer({\n  fields: [\n    {\n      name: 'first_name',\n      label: 'First Name',\n      placeholder: 'Something',\n      required: true\n    },\n    {\n      name: 'last_name',\n      label: 'Last Name',\n      tests: [\n        {\n          test: function (val) {\n            return false;\n          },\n          message: 'something will always go wrong'\n        },\n        {\n          test: function (val) {\n            return val && val.toString().length > 2;\n          },\n          message: 'Must be at least three characters.'\n        }\n      ],\n      required: true\n    }\n  ],\n  submit: function (vals) {\n    console.log(vals);\n  },\n  error: function (vals) {\n    console.log('error', vals);\n  }\n});\n```\n\n\n##Step #2: Render it once. It handles itself after that:\n   \n```javascript \ndocument.addEventListener('DOMContentLoaded', function () {\n  document.querySelector('#something').appendChild(f.render());\n});\n```\n\n\nreformer will handle form submit, and call your callback if everything's happy.\n\n##Bonus Step #3: Asynchronous validation\n\nYou know how you've always got that one field that needs to be checked via ajax. It's a pain. Because most of your tests are simple regexes that can be run synchronously except for this one stupid ajax call to check if a username is available. So, just do this:\n\n```javascript\n// your field definition\n{\n  name: 'email',\n  label: 'Email',\n  tests: [\n    // BAM! add the `async` flag and your test will receive a third argument. A callback.\n    {\n      async: true, \n      test: function (email, formInstance, cb) {\n        $.get('/email-is-avail?val=' + email, function (data) {\n          cb(data === '1');\n        });\n      },\n      message: 'This email is already in use.'\n    },\n    // You can have simple synchronous tests alongside as well.\n    // and it still Just Works™\n    {\n      test: _.isEmail,\n      message: 'This doesn\\'t seem like a real email address'\n    }\n  ],\n  required: true\n}\n```\n\nIt's simple, but that's all for now. Because it works for what I need for this particular app. Contributions welcomed.\n\nCheers,\n\n \\- [@HenrikJoreteg](http://twitter.com/henrikjoreteg)\n\n##Gotchas\n\n - Still needs a bit more work/polish/testing.\n - Requires IE8 or newer because I didn't want jQuery as a dependency.\n - Won't really work with checkboxes/radioboxes and such, just yet.\n\n##License\n\nMIT\n\n\n","_id":"reformer@0.0.1","dist":{"shasum":"23b770c698fa7c1afe0a7738dd78c15e797b8f34","tarball":"https://registry.npmjs.org/reformer/-/reformer-0.0.1.tgz","integrity":"sha512-zUnE/r4hatLHRQKtJdINBg+i9uOe39Xoo3dka4n61wi8W4y6UT7VuGWK/+eSdJ82V/PXvejVSgMMyvqtUvLg5A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIChqhGW/m4KClsTb2hjE7IMT6m2X4e50G+y818UU4XMdAiEAyIsMA2iMu3y7BlI0u7nJvAFO0y95fRkRaV/FfOz+TE8="}]},"maintainers":[{"name":"henrikjoreteg","email":"henrik@andyet.net"}],"directories":{}},"0.0.2":{"name":"reformer","version":"0.0.2","author":{"name":"Henrik Joreteg","email":"henrik@andyet.net"},"description":"Self-contained, self-rendering, self-validating forms that can only output valid data.","dependencies":{"jade":"","uglify-js":"1.x","underscore":"","colors":"","yetify":""},"repository":{"type":"git","url":"https://github.com/HenrikJoreteg/reformer.git"},"keywords":["form","browser","jade"],"main":"reformer.js","readme":"#reformer\n\nSelf-contained, self-rendering, self-validating forms that can only output valid data.\n\n##Step #1: Define your fields, with as many tests as you want for each field:\n\n```javascript\nvar f = new Reformer({\n  submitText: 'Submit this form!',\n  fields: [\n    {\n      name: 'first_name',\n      label: 'First Name',\n      placeholder: 'Something',\n      required: true\n    },\n    {\n      name: 'last_name',\n      label: 'Last Name',\n      tests: [\n        {\n          test: function (val) {\n            return false;\n          },\n          message: 'something will always go wrong'\n        },\n        {\n          test: function (val) {\n            return val && val.toString().length > 2;\n          },\n          message: 'Must be at least three characters.'\n        }\n      ],\n      required: true\n    }\n  ],\n  submit: function (vals) {\n    console.log(vals);\n  },\n  error: function (vals) {\n    console.log('error', vals);\n  }\n});\n```\n\n\n##Step #2: Render it once. It handles itself after that:\n   \n```javascript \ndocument.addEventListener('DOMContentLoaded', function () {\n  document.querySelector('#something').appendChild(f.render());\n});\n```\n\n\nreformer will handle form submit, and call your callback if everything's happy.\n\n##Bonus Step #3: Asynchronous validation\n\nYou know how you've always got that one field that needs to be checked via ajax. It's a pain. Because most of your tests are simple regexes that can be run synchronously except for this one stupid ajax call to check if a username is available. So, just do this:\n\n```javascript\n// your field definition\n{\n  name: 'email',\n  label: 'Email',\n  tests: [\n    // BAM! add the `async` flag and your test will receive a third argument. A callback.\n    {\n      async: true, \n      test: function (email, formInstance, cb) {\n        $.get('/email-is-avail?val=' + email, function (data) {\n          cb(data === '1');\n        });\n      },\n      message: 'This email is already in use.'\n    },\n    // You can have simple synchronous tests alongside as well.\n    // and it still Just Works™\n    {\n      test: _.isEmail,\n      message: 'This doesn\\'t seem like a real email address'\n    }\n  ],\n  required: true\n}\n```\n\nIt's simple, but that's all for now. Because it works for what I need for this particular app. Contributions welcomed.\n\nCheers,\n\n \\- [@HenrikJoreteg](http://twitter.com/henrikjoreteg)\n\n##Gotchas\n\n - Still needs a bit more work/polish/testing.\n - Requires IE8 or newer because I didn't want jQuery as a dependency.\n - Won't really work with checkboxes/radioboxes and such, just yet.\n\n##License\n\nMIT\n\n\n","_id":"reformer@0.0.2","dist":{"shasum":"61af846408889b19a9404132c5a381e6965fdc4e","tarball":"https://registry.npmjs.org/reformer/-/reformer-0.0.2.tgz","integrity":"sha512-tBN/T1KpaDR8be4XOxKzKv+zV4Ut8xZftvIkTYhnG9I0r4T/iBLxI9IjldEgDGihJ1HRN4WcenLXu3IkCLXegw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC6dHpzSAtGUdsUw3+2bLvqEO0HTDYzy7Pf1vRGPvHAgAiEAlhh9ECaIh/HRkr63Hkvno1u3c8fvG6W5yI1GzxDQb+w="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"henrikjoreteg","email":"henrik@andyet.net"},"maintainers":[{"name":"henrikjoreteg","email":"henrik@andyet.net"}],"directories":{}},"0.0.3":{"name":"reformer","version":"0.0.3","author":{"name":"Henrik Joreteg","email":"henrik@andyet.net"},"description":"Self-contained, self-rendering, self-validating forms that can only output valid data.","dependencies":{"jade":"","uglify-js":"1.x","underscore":"","colors":"","yetify":""},"repository":{"type":"git","url":"https://github.com/HenrikJoreteg/reformer.git"},"keywords":["form","browser","jade"],"main":"reformer.js","readme":"#reformer\n\nSelf-contained, self-rendering, self-validating forms that can only output valid data.\n\n##Step #1: Define your fields, with as many tests as you want for each field:\n\n```javascript\nvar f = new Reformer({\n  submitText: 'Submit this form!',\n  fields: [\n    {\n      name: 'first_name',\n      label: 'First Name',\n      placeholder: 'Something',\n      required: true\n    },\n    {\n      name: 'last_name',\n      label: 'Last Name',\n      tests: [\n        {\n          test: function (val) {\n            return false;\n          },\n          message: 'something will always go wrong'\n        },\n        {\n          test: function (val) {\n            return val && val.toString().length > 2;\n          },\n          message: 'Must be at least three characters.'\n        }\n      ],\n      required: true\n    }\n  ],\n  submit: function (vals) {\n    console.log(vals);\n  },\n  error: function (vals) {\n    console.log('error', vals);\n  }\n});\n```\n\n\n##Step #2: Render it once. It handles itself after that:\n   \n```javascript \ndocument.addEventListener('DOMContentLoaded', function () {\n  document.querySelector('#something').appendChild(f.render());\n});\n```\n\n\nreformer will handle form submit, and call your callback if everything's happy.\n\n##Bonus Step #3: Asynchronous validation\n\nYou know how you've always got that one field that needs to be checked via ajax. It's a pain. Because most of your tests are simple regexes that can be run synchronously except for this one stupid ajax call to check if a username is available. So, just do this:\n\n```javascript\n// your field definition\n{\n  name: 'email',\n  label: 'Email',\n  tests: [\n    // BAM! add the `async` flag and your test will receive a third argument. A callback.\n    {\n      async: true, \n      test: function (email, formInstance, cb) {\n        $.get('/email-is-avail?val=' + email, function (data) {\n          cb(data === '1');\n        });\n      },\n      message: 'This email is already in use.'\n    },\n    // You can have simple synchronous tests alongside as well.\n    // and it still Just Works™\n    {\n      test: _.isEmail,\n      message: 'This doesn\\'t seem like a real email address'\n    }\n  ],\n  required: true\n}\n```\n\nIt's simple, but that's all for now. Because it works for what I need for this particular app. Contributions welcomed.\n\nCheers,\n\n \\- [@HenrikJoreteg](http://twitter.com/henrikjoreteg)\n\n##Gotchas\n\n - Still needs a bit more work/polish/testing.\n - Requires IE8 or newer because I didn't want jQuery as a dependency.\n - Won't really work with checkboxes/radioboxes and such, just yet.\n\n##License\n\nMIT\n\n\n","_id":"reformer@0.0.3","dist":{"shasum":"9cb5a26939083426aeb337bfcc53be46d0c721c4","tarball":"https://registry.npmjs.org/reformer/-/reformer-0.0.3.tgz","integrity":"sha512-cE1JrSWRt5ACVyHWyOhQ+na/YFAxdotoEkRYr06IYBsuBavrekHVSk0XQaCEwBYRoga3xh1vLy1CVlVYVNwtMQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHUWqfFOyiPyK4uIcExdIcw/Jhjo3skGHlAgDjEdqkrwAiBjt8698lEI+56auuLEUDrvsmi+m+EFxF6QlB/sRryF3A=="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"henrikjoreteg","email":"henrik@andyet.net"},"maintainers":[{"name":"henrikjoreteg","email":"henrik@andyet.net"}],"directories":{}},"0.0.4":{"name":"reformer","version":"0.0.4","author":{"name":"Henrik Joreteg","email":"henrik@andyet.net"},"description":"Self-contained, self-rendering, self-validating forms that can only output valid data.","dependencies":{"jade":"","uglify-js":"1.x","underscore":"","colors":"","yetify":""},"repository":{"type":"git","url":"https://github.com/HenrikJoreteg/reformer.git"},"keywords":["form","browser","jade"],"main":"reformer.js","readme":"#reformer\n\nSelf-contained, self-rendering, self-validating forms that can only output valid data.\n\n##Step #1: Define your fields, with as many tests as you want for each field:\n\n```javascript\nvar f = new Reformer({\n  submitText: 'Submit this form!',\n  fields: [\n    {\n      name: 'first_name',\n      label: 'First Name',\n      placeholder: 'Something',\n      required: true\n    },\n    {\n      name: 'last_name',\n      label: 'Last Name',\n      tests: [\n        {\n          test: function (val) {\n            return false;\n          },\n          message: 'something will always go wrong'\n        },\n        {\n          test: function (val) {\n            return val && val.toString().length > 2;\n          },\n          message: 'Must be at least three characters.'\n        }\n      ],\n      required: true\n    }\n  ],\n  submit: function (vals) {\n    console.log(vals);\n  },\n  error: function (vals) {\n    console.log('error', vals);\n  }\n});\n```\n\n\n##Step #2: Render it once. It handles itself after that:\n   \n```javascript \ndocument.addEventListener('DOMContentLoaded', function () {\n  document.querySelector('#something').appendChild(f.render());\n});\n```\n\n\nreformer will handle form submit, and call your callback if everything's happy.\n\n##Bonus Step #3: Asynchronous validation\n\nYou know how you've always got that one field that needs to be checked via ajax. It's a pain. Because most of your tests are simple regexes that can be run synchronously except for this one stupid ajax call to check if a username is available. So, just do this:\n\n```javascript\n// your field definition\n{\n  name: 'email',\n  label: 'Email',\n  tests: [\n    // BAM! add the `async` flag and your test will receive a third argument. A callback.\n    {\n      async: true, \n      test: function (email, formInstance, cb) {\n        $.get('/email-is-avail?val=' + email, function (data) {\n          cb(data === '1');\n        });\n      },\n      message: 'This email is already in use.'\n    },\n    // You can have simple synchronous tests alongside as well.\n    // and it still Just Works™\n    {\n      test: _.isEmail,\n      message: 'This doesn\\'t seem like a real email address'\n    }\n  ],\n  required: true\n}\n```\n\nIt's simple, but that's all for now. Because it works for what I need for this particular app. Contributions welcomed.\n\nCheers,\n\n \\- [@HenrikJoreteg](http://twitter.com/henrikjoreteg)\n\n##Gotchas\n\n - Still needs a bit more work/polish/testing.\n - Requires IE8 or newer because I didn't want jQuery as a dependency.\n - Won't really work with checkboxes/radioboxes and such, just yet.\n\n##License\n\nMIT\n\n\n","_id":"reformer@0.0.4","dist":{"shasum":"10097b793fc621b2090791dce3f180b26d6f9ecf","tarball":"https://registry.npmjs.org/reformer/-/reformer-0.0.4.tgz","integrity":"sha512-G/KPfzJMHYWK8TU96JyOTywDA9SODueOxJf3JnaErntBMpdpQVy1je5aSB1k1aMUBV8VuVLryEAAgM6u+AM/Dw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIG/O0oQ5Rmpkzkz3HdC0P6JQxkVXWIw0Rp70YbI5G9LoAiADqMgY61JTJYP4NO3nSxO5U70M54TNt5m+HJe4wn6HFA=="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"henrikjoreteg","email":"henrik@andyet.net"},"maintainers":[{"name":"henrikjoreteg","email":"henrik@andyet.net"}],"directories":{}},"0.0.5":{"name":"reformer","version":"0.0.5","author":{"name":"Henrik Joreteg","email":"henrik@andyet.net"},"description":"Self-contained, self-rendering, self-validating forms that can only output valid data.","dependencies":{"jade":"","uglify-js":"1.x","underscore":"","colors":"","yetify":""},"repository":{"type":"git","url":"https://github.com/HenrikJoreteg/reformer.git"},"keywords":["form","browser","jade"],"main":"reformer.js","readme":"#reformer\n\nSelf-contained, self-rendering, self-validating forms that can only output valid data.\n\n##Step #1: Define your fields, with as many tests as you want for each field:\n\n```javascript\nvar f = new Reformer({\n  submitText: 'Submit this form!',\n  fields: [\n    {\n      name: 'first_name',\n      label: 'First Name',\n      placeholder: 'Something',\n      required: true\n    },\n    {\n      name: 'last_name',\n      label: 'Last Name',\n      tests: [\n        {\n          test: function (val) {\n            return false;\n          },\n          message: 'something will always go wrong'\n        },\n        {\n          test: function (val) {\n            return val && val.toString().length > 2;\n          },\n          message: 'Must be at least three characters.'\n        }\n      ],\n      required: true\n    }\n  ],\n  submit: function (vals) {\n    console.log(vals);\n  },\n  error: function (vals) {\n    console.log('error', vals);\n  }\n});\n```\n\n\n##Step #2: Render it once. It handles itself after that:\n   \n```javascript \ndocument.addEventListener('DOMContentLoaded', function () {\n  document.querySelector('#something').appendChild(f.render());\n});\n```\n\n\nreformer will handle form submit, and call your callback if everything's happy.\n\n##Bonus Step #3: Asynchronous validation\n\nYou know how you've always got that one field that needs to be checked via ajax. It's a pain. Because most of your tests are simple regexes that can be run synchronously except for this one stupid ajax call to check if a username is available. So, just do this:\n\n```javascript\n// your field definition\n{\n  name: 'email',\n  label: 'Email',\n  tests: [\n    // BAM! add the `async` flag and your test will receive a third argument. A callback.\n    {\n      async: true, \n      test: function (email, formInstance, cb) {\n        $.get('/email-is-avail?val=' + email, function (data) {\n          cb(data === '1');\n        });\n      },\n      message: 'This email is already in use.'\n    },\n    // You can have simple synchronous tests alongside as well.\n    // and it still Just Works™\n    {\n      test: _.isEmail,\n      message: 'This doesn\\'t seem like a real email address'\n    }\n  ],\n  required: true\n}\n```\n\nIt's simple, but that's all for now. Because it works for what I need for this particular app. Contributions welcomed.\n\nCheers,\n\n \\- [@HenrikJoreteg](http://twitter.com/henrikjoreteg)\n\n##Gotchas\n\n - Still needs a bit more work/polish/testing.\n - Requires IE8 or newer because I didn't want jQuery as a dependency.\n - Won't really work with checkboxes/radioboxes and such, just yet.\n\n##License\n\nMIT\n\n\n","_id":"reformer@0.0.5","dist":{"shasum":"62705282a4a06a9c9607ce806d530d4b1ca7f9f7","tarball":"https://registry.npmjs.org/reformer/-/reformer-0.0.5.tgz","integrity":"sha512-fOOWdRnMzHrbXcc7wquqpiA7Qs/GMwSX3DgNymWcTHLt0odHtHVZ79BvWwXrV6XAJwZrwGg4fIYxldnvjpB0rg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDdFs5ERt0kLa8ro/odliLNjaWCPnLvN8hRN+bH7e4X0gIgZAHYiAMNBCfu4O9dIcr93VQ+Yzlo5BcyTQqL1GHUGAE="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"henrikjoreteg","email":"henrik@andyet.net"},"maintainers":[{"name":"henrikjoreteg","email":"henrik@andyet.net"}],"directories":{}},"1.0.0":{"name":"reformer","version":"1.0.0","author":{"name":"Henrik Joreteg","email":"henrik@andyet.net"},"description":"Super customizable, Self-contained, self-rendering, self-validating forms that can only output valid data.","dependencies":{"domify":"1.0.0"},"devDependencies":{"templatizer":"0.0.12","browserify":"2.25.0"},"repository":{"type":"git","url":"https://github.com/HenrikJoreteg/reformer.git"},"keywords":["form","browser"],"main":"reformer.js","readme":"#reformer\n\nSelf-contained, self-rendering, self-validating forms that can only output valid data.\n\n##Step #1: Define your fields, with as many tests as you want for each field:\n\n```javascript\nvar f = new Reformer({\n  fields: [\n    {\n      name: 'first_name',\n      label: 'First Name',\n      placeholder: 'Something',\n      required: true\n    },\n    {\n      name: 'last_name',\n      label: 'Last Name',\n      tests: [\n        {\n          test: function (val) {\n            return false;\n          },\n          message: 'something will always go wrong'\n        },\n        {\n          test: function (val) {\n            return val && val.toString().length > 2;\n          },\n          message: 'Must be at least three characters.'\n        }\n      ],\n      required: true\n    }\n  ],\n  submit: function (vals) {\n    console.log(vals);\n  },\n  error: function (vals) {\n    console.log('error', vals);\n  }\n});\n```\n\n\n##Step #2: Render it once. It handles itself after that:\n   \n```javascript \ndocument.addEventListener('DOMContentLoaded', function () {\n  // render our form from about, just tell it where.\n  f.render({\n    formEl: document.getElementById('myform'),\n    fieldContainer: document.getElementById('fieldContainer'),\n  });\n});\n```\n\nReformer will handle form submit, and call your callback if everything's happy.\n\n##Bonus Step #3: Asynchronous validation\n\nYou know how you've always got that one field that needs to be checked via ajax. It's a pain. Because most of your tests are simple regexes that can be run synchronously except for this one stupid ajax call to check if a username is available. So, just do this:\n\n```javascript\n// your field definition\n{\n  name: 'email',\n  label: 'Email',\n  tests: [\n    // BAM! add the `async` flag and your test will receive a third argument. A callback.\n    {\n      async: true, \n      test: function (email, formInstance, cb) {\n        $.get('/email-is-avail?val=' + email, function (data) {\n          cb(data === '1');\n        });\n      },\n      message: 'This email is already in use.'\n    },\n    // You can have simple synchronous tests alongside as well.\n    // and it still Just Works™\n    {\n      test: _.isEmail,\n      message: 'This doesn\\'t seem like a real email address'\n    }\n  ],\n  required: true\n}\n```\n\nIt's simple, but that's all for now. Because it works for what I need for this particular app. Contributions welcomed.\n\nCheers,\n\n \\- [@HenrikJoreteg](http://twitter.com/henrikjoreteg)\n\n##Gotchas\n\n - Still needs a bit more work/polish/testing.\n - Requires IE8 or newer because I didn't want jQuery as a dependency.\n - Won't really work with checkboxes/radioboxes and such, just yet.\n\n##License\n\nMIT\n\n\n","_id":"reformer@1.0.0","dist":{"shasum":"abdebd7b122fbeabdd9c04aea7208e8c12afb6c6","tarball":"https://registry.npmjs.org/reformer/-/reformer-1.0.0.tgz","integrity":"sha512-vAT0Jq74yVfE9exvsuvFrhDpqzGBVNfT2Y2/lo+9AoLK1JbnJUrbe8Xm4k9zOOwhSC/xrXJK982C81UTBcAcjg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCsqQPcrWHwEZFgHghEcw5asA4sEwlMObaHSuLTc02O0wIhAPKV8IuVxkct/i3YLDt7sUNCo9M1SoLre7izsWDwye/z"}]},"_npmVersion":"1.1.62","_npmUser":{"name":"henrikjoreteg","email":"henrik@andyet.net"},"maintainers":[{"name":"henrikjoreteg","email":"henrik@andyet.net"}],"directories":{}},"1.0.1":{"name":"reformer","version":"1.0.1","author":{"name":"Henrik Joreteg","email":"henrik@andyet.net"},"description":"Super customizable, Self-contained, self-rendering, self-validating forms that can only output valid data.","dependencies":{"domify":"1.0.0"},"devDependencies":{"templatizer":"0.0.12","browserify":"2.25.0","uglify-js":"2.3.6"},"repository":{"type":"git","url":"https://github.com/HenrikJoreteg/reformer.git"},"keywords":["form","browser"],"main":"reformer.js","readme":"#reformer\n\nSelf-contained, self-rendering, self-validating forms that can only output valid data.\n\n##Step #1: Define your fields, with as many tests as you want for each field:\n\n```javascript\nvar f = new Reformer({\n  fields: [\n    {\n      name: 'first_name',\n      label: 'First Name',\n      placeholder: 'Something',\n      required: true\n    },\n    {\n      name: 'last_name',\n      label: 'Last Name',\n      tests: [\n        {\n          test: function (val) {\n            return false;\n          },\n          message: 'something will always go wrong'\n        },\n        {\n          test: function (val) {\n            return val && val.toString().length > 2;\n          },\n          message: 'Must be at least three characters.'\n        }\n      ],\n      required: true\n    }\n  ],\n  submit: function (vals) {\n    console.log(vals);\n  },\n  error: function (vals) {\n    console.log('error', vals);\n  }\n});\n```\n\n\n##Step #2: Render it once. It handles itself after that:\n   \n```javascript \ndocument.addEventListener('DOMContentLoaded', function () {\n  // render our form from about, just tell it where.\n  f.render({\n    formEl: document.getElementById('myform'),\n    fieldContainer: document.getElementById('fieldContainer'),\n  });\n});\n```\n\nReformer will handle form submit, and call your callback if everything's happy.\n\n##Bonus Step #3: Asynchronous validation\n\nYou know how you've always got that one field that needs to be checked via ajax. It's a pain. Because most of your tests are simple regexes that can be run synchronously except for this one stupid ajax call to check if a username is available. So, just do this:\n\n```javascript\n// your field definition\n{\n  name: 'email',\n  label: 'Email',\n  tests: [\n    // BAM! add the `async` flag and your test will receive a third argument. A callback.\n    {\n      async: true, \n      test: function (email, formInstance, cb) {\n        $.get('/email-is-avail?val=' + email, function (data) {\n          cb(data === '1');\n        });\n      },\n      message: 'This email is already in use.'\n    },\n    // You can have simple synchronous tests alongside as well.\n    // and it still Just Works™\n    {\n      test: _.isEmail,\n      message: 'This doesn\\'t seem like a real email address'\n    }\n  ],\n  required: true\n}\n```\n\nIt's simple, but that's all for now. Because it works for what I need for this particular app. Contributions welcomed.\n\nCheers,\n\n \\- [@HenrikJoreteg](http://twitter.com/henrikjoreteg)\n\n##Gotchas\n\n - Still needs a bit more work/polish/testing.\n - Requires IE8 or newer because I didn't want jQuery as a dependency.\n - Won't really work with checkboxes/radioboxes and such, just yet.\n\n##License\n\nMIT\n\n\n","_id":"reformer@1.0.1","dist":{"shasum":"fb598bb5720765827f43265ed69f510caaeab28b","tarball":"https://registry.npmjs.org/reformer/-/reformer-1.0.1.tgz","integrity":"sha512-NSLuwlghefy/Gjo0/M3d8cdWds/m7yTXSqhcDYypf7NZ0mY1cxuBh/wfy+EzhfnOmJoP0nIIIRiBRw3yMrWsfA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD+mUlrNmrIhBtOzpqX5AHKHrYClh4m3eNODutj5QpZNgIhANprOVRI1Qr7Kg9mJOD+QqFIMU0JjtpLPaZBNX1gXsf1"}]},"_npmVersion":"1.1.62","_npmUser":{"name":"henrikjoreteg","email":"henrik@andyet.net"},"maintainers":[{"name":"henrikjoreteg","email":"henrik@andyet.net"}],"directories":{}},"1.1.0":{"name":"reformer","version":"1.1.0","author":{"name":"Henrik Joreteg","email":"henrik@andyet.net"},"description":"Super customizable, Self-contained, self-rendering, self-validating forms that can only output valid data.","dependencies":{"domify":"1.0.0"},"devDependencies":{"templatizer":"0.0.12","browserify":"2.25.0","uglify-js":"2.3.6"},"repository":{"type":"git","url":"https://github.com/HenrikJoreteg/reformer.git"},"keywords":["form","browser"],"main":"reformer.js","readme":"#reformer\n\nSelf-contained, self-rendering, self-validating forms that can only output valid data.\n\n##Step #1: Define your fields, with as many tests as you want for each field:\n\n```javascript\nvar f = new Reformer({\n  fields: [\n    {\n      name: 'first_name',\n      label: 'First Name',\n      placeholder: 'Something',\n      required: true\n    },\n    {\n      name: 'last_name',\n      label: 'Last Name',\n      tests: [\n        {\n          test: function (val) {\n            return false;\n          },\n          message: 'something will always go wrong'\n        },\n        {\n          test: function (val) {\n            return val && val.toString().length > 2;\n          },\n          message: 'Must be at least three characters.'\n        }\n      ],\n      required: true\n    }\n  ],\n  submit: function (vals) {\n    console.log(vals);\n  },\n  error: function (vals) {\n    console.log('error', vals);\n  }\n});\n```\n\n\n##Step #2: Render it once. It handles itself after that:\n   \n```javascript \ndocument.addEventListener('DOMContentLoaded', function () {\n  // render our form from about, just tell it where.\n  f.render({\n    formEl: document.getElementById('myform'),\n    fieldContainer: document.getElementById('fieldContainer'),\n  });\n});\n```\n\nReformer will handle form submit, and call your callback if everything's happy.\n\n##Bonus Step #3: Asynchronous validation\n\nYou know how you've always got that one field that needs to be checked via ajax. It's a pain. Because most of your tests are simple regexes that can be run synchronously except for this one stupid ajax call to check if a username is available. So, just do this:\n\n```javascript\n// your field definition\n{\n  name: 'email',\n  label: 'Email',\n  tests: [\n    // BAM! add the `async` flag and your test will receive a third argument. A callback.\n    {\n      async: true, \n      test: function (email, formInstance, cb) {\n        $.get('/email-is-avail?val=' + email, function (data) {\n          cb(data === '1');\n        });\n      },\n      message: 'This email is already in use.'\n    },\n    // You can have simple synchronous tests alongside as well.\n    // and it still Just Works™\n    {\n      test: _.isEmail,\n      message: 'This doesn\\'t seem like a real email address'\n    }\n  ],\n  required: true\n}\n```\n\nIt's simple, but that's all for now. Because it works for what I need for this particular app. Contributions welcomed.\n\nCheers,\n\n \\- [@HenrikJoreteg](http://twitter.com/henrikjoreteg)\n\n##Gotchas\n\n - Still needs a bit more work/polish/testing.\n - Requires IE8 or newer because I didn't want jQuery as a dependency.\n - Won't really work with checkboxes/radioboxes and such, just yet.\n\n##License\n\nMIT\n\n\n","_id":"reformer@1.1.0","dist":{"shasum":"130bc2a715ba42584deb1558a5480b01c3b28b58","tarball":"https://registry.npmjs.org/reformer/-/reformer-1.1.0.tgz","integrity":"sha512-VLVi/dtSkh+WXD6fDDJHuVLa9iwv/Llm78mDXiHMSJgQl9bz/ZbMtC62Gzk2Pp5XE+Q7kdECl/dxshxPSWo+7w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAo2wNPeR8tNCmjJUDZHr+CITnEqoAo0tR+K9P6XTM5eAiEAkYr+N1W2q3dJhvIvhhpCtbWEDiBeq5pZRMxB48McY6g="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"henrikjoreteg","email":"henrik@andyet.net"},"maintainers":[{"name":"henrikjoreteg","email":"henrik@andyet.net"}],"directories":{}},"1.1.1":{"name":"reformer","version":"1.1.1","author":{"name":"Henrik Joreteg","email":"henrik@andyet.net"},"description":"Super customizable, Self-contained, self-rendering, self-validating forms that can only output valid data.","dependencies":{"domify":"1.0.0"},"devDependencies":{"templatizer":"0.0.12","browserify":"2.25.0","uglify-js":"2.3.6"},"repository":{"type":"git","url":"https://github.com/HenrikJoreteg/reformer.git"},"keywords":["form","browser"],"main":"reformer.js","readme":"#reformer\n\nSelf-contained, self-rendering, self-validating forms that can only output valid data.\n\n##Step #1: Define your fields, with as many tests as you want for each field:\n\n```javascript\nvar f = new Reformer({\n  fields: [\n    {\n      name: 'first_name',\n      label: 'First Name',\n      placeholder: 'Something',\n      required: true\n    },\n    {\n      name: 'last_name',\n      label: 'Last Name',\n      tests: [\n        {\n          test: function (val) {\n            return false;\n          },\n          message: 'something will always go wrong'\n        },\n        {\n          test: function (val) {\n            return val && val.toString().length > 2;\n          },\n          message: 'Must be at least three characters.'\n        }\n      ],\n      required: true\n    }\n  ],\n  submit: function (vals) {\n    console.log(vals);\n  },\n  error: function (vals) {\n    console.log('error', vals);\n  }\n});\n```\n\n\n##Step #2: Render it once. It handles itself after that:\n   \n```javascript \ndocument.addEventListener('DOMContentLoaded', function () {\n  // render our form from about, just tell it where.\n  f.render({\n    formEl: document.getElementById('myform'),\n    fieldContainer: document.getElementById('fieldContainer'),\n  });\n});\n```\n\nReformer will handle form submit, and call your callback if everything's happy.\n\n##Bonus Step #3: Asynchronous validation\n\nYou know how you've always got that one field that needs to be checked via ajax. It's a pain. Because most of your tests are simple regexes that can be run synchronously except for this one stupid ajax call to check if a username is available. So, just do this:\n\n```javascript\n// your field definition\n{\n  name: 'email',\n  label: 'Email',\n  tests: [\n    // BAM! add the `async` flag and your test will receive a third argument. A callback.\n    {\n      async: true, \n      test: function (email, formInstance, cb) {\n        $.get('/email-is-avail?val=' + email, function (data) {\n          cb(data === '1');\n        });\n      },\n      message: 'This email is already in use.'\n    },\n    // You can have simple synchronous tests alongside as well.\n    // and it still Just Works™\n    {\n      test: _.isEmail,\n      message: 'This doesn\\'t seem like a real email address'\n    }\n  ],\n  required: true\n}\n```\n\nIt's simple, but that's all for now. Because it works for what I need for this particular app. Contributions welcomed.\n\nCheers,\n\n \\- [@HenrikJoreteg](http://twitter.com/henrikjoreteg)\n\n##Gotchas\n\n - Still needs a bit more work/polish/testing.\n - Requires IE8 or newer because I didn't want jQuery as a dependency.\n - Won't really work with checkboxes/radioboxes and such, just yet.\n\n##License\n\nMIT\n\n\n","_id":"reformer@1.1.1","dist":{"shasum":"7054b507850d16ed10538b8baacc5681ab1d812c","tarball":"https://registry.npmjs.org/reformer/-/reformer-1.1.1.tgz","integrity":"sha512-9T1D+t7GVcvSlX9Ui0wBkz1GoXT7vFtb6Av5lG3qFpt3X/nQ5zUdxTXf88vltM3ezGSwpnHXMw/XpM9uHD9wsg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC8XjIxrDtZiQcBagD6glU1lzcoXjdBJWZV63nZcbdjpgIhAOZDyZwgv0x46m6nGwzM56z0Pj7liV5DWSP5BviVB9GA"}]},"_npmVersion":"1.1.62","_npmUser":{"name":"henrikjoreteg","email":"henrik@andyet.net"},"maintainers":[{"name":"henrikjoreteg","email":"henrik@andyet.net"}],"directories":{}},"1.1.2":{"name":"reformer","version":"1.1.2","author":{"name":"Henrik Joreteg","email":"henrik@andyet.net"},"description":"Super customizable, Self-contained, self-rendering, self-validating forms that can only output valid data.","dependencies":{"domify":"1.0.0"},"devDependencies":{"templatizer":"0.0.12","browserify":"2.25.0","uglify-js":"2.3.6"},"repository":{"type":"git","url":"https://github.com/HenrikJoreteg/reformer.git"},"keywords":["form","browser"],"main":"reformer.js","readme":"#reformer\n\nSelf-contained, self-rendering, self-validating forms that can only output valid data.\n\n##Step #1: Define your fields, with as many tests as you want for each field:\n\n```javascript\nvar f = new Reformer({\n  fields: [\n    {\n      name: 'first_name',\n      label: 'First Name',\n      placeholder: 'Something',\n      required: true\n    },\n    {\n      name: 'last_name',\n      label: 'Last Name',\n      tests: [\n        {\n          test: function (val) {\n            return false;\n          },\n          message: 'something will always go wrong'\n        },\n        {\n          test: function (val) {\n            return val && val.toString().length > 2;\n          },\n          message: 'Must be at least three characters.'\n        }\n      ],\n      required: true\n    }\n  ],\n  submit: function (vals) {\n    console.log(vals);\n  },\n  error: function (vals) {\n    console.log('error', vals);\n  }\n});\n```\n\n\n##Step #2: Render it once. It handles itself after that:\n   \n```javascript \ndocument.addEventListener('DOMContentLoaded', function () {\n  // render our form from about, just tell it where.\n  f.render({\n    formEl: document.getElementById('myform'),\n    fieldContainer: document.getElementById('fieldContainer'),\n  });\n});\n```\n\nReformer will handle form submit, and call your callback if everything's happy.\n\n##Bonus Step #3: Asynchronous validation\n\nYou know how you've always got that one field that needs to be checked via ajax. It's a pain. Because most of your tests are simple regexes that can be run synchronously except for this one stupid ajax call to check if a username is available. So, just do this:\n\n```javascript\n// your field definition\n{\n  name: 'email',\n  label: 'Email',\n  tests: [\n    // BAM! add the `async` flag and your test will receive a third argument. A callback.\n    {\n      async: true, \n      test: function (email, formInstance, cb) {\n        $.get('/email-is-avail?val=' + email, function (data) {\n          cb(data === '1');\n        });\n      },\n      message: 'This email is already in use.'\n    },\n    // You can have simple synchronous tests alongside as well.\n    // and it still Just Works™\n    {\n      test: _.isEmail,\n      message: 'This doesn\\'t seem like a real email address'\n    }\n  ],\n  required: true\n}\n```\n\nIt's simple, but that's all for now. Because it works for what I need for this particular app. Contributions welcomed.\n\nCheers,\n\n \\- [@HenrikJoreteg](http://twitter.com/henrikjoreteg)\n\n##Gotchas\n\n - Still needs a bit more work/polish/testing.\n - Requires IE8 or newer because I didn't want jQuery as a dependency.\n\n##License\n\nMIT\n\n\n","_id":"reformer@1.1.2","dist":{"shasum":"d5782060d867225049528b9069b1e76f8f571aaf","tarball":"https://registry.npmjs.org/reformer/-/reformer-1.1.2.tgz","integrity":"sha512-Z7bJsbpHozSqdeUoxfq8tbkQNpOj86kHcfeqGp7SKdhBsdeyFDdybZ8WEi8m6BPyS+3BBm7AdV4QzVLST36UWQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDUL40i8wH4YDBfY8oomBxBgyRr5shXee4urUckPGr2XAiAOF3tltE7hk5Cd2QYgVv6zurv4+Z+ysF8x/F33wE3T7Q=="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"henrikjoreteg","email":"henrik@andyet.net"},"maintainers":[{"name":"henrikjoreteg","email":"henrik@andyet.net"}]},"1.2.0":{"name":"reformer","version":"1.2.0","author":{"name":"Henrik Joreteg","email":"henrik@andyet.net"},"description":"Super customizable, Self-contained, self-rendering, self-validating forms that can only output valid data.","dependencies":{"domify":"1.0.0"},"devDependencies":{"templatizer":"0.0.12","browserify":"2.25.0","uglify-js":"2.3.6"},"repository":{"type":"git","url":"https://github.com/HenrikJoreteg/reformer.git"},"keywords":["form","browser"],"main":"reformer.js","readme":"#reformer\n\nSelf-contained, self-rendering, self-validating forms that can only output valid data.\n\n##Step #1: Define your fields, with as many tests as you want for each field:\n\n```javascript\nvar f = new Reformer({\n  fields: [\n    {\n      name: 'first_name',\n      label: 'First Name',\n      placeholder: 'Something',\n      required: true\n    },\n    {\n      name: 'last_name',\n      label: 'Last Name',\n      tests: [\n        {\n          test: function (val) {\n            return false;\n          },\n          message: 'something will always go wrong'\n        },\n        {\n          test: function (val) {\n            return val && val.toString().length > 2;\n          },\n          message: 'Must be at least three characters.'\n        }\n      ],\n      required: true\n    }\n  ],\n  submit: function (vals) {\n    console.log(vals);\n  },\n  error: function (vals) {\n    console.log('error', vals);\n  }\n});\n```\n\n\n##Step #2: Render it once. It handles itself after that:\n   \n```javascript \ndocument.addEventListener('DOMContentLoaded', function () {\n  // render our form from about, just tell it where.\n  f.render({\n    formEl: document.getElementById('myform'),\n    fieldContainer: document.getElementById('fieldContainer'),\n  });\n});\n```\n\nReformer will handle form submit, and call your callback if everything's happy.\n\n##Bonus Step #3: Asynchronous validation\n\nYou know how you've always got that one field that needs to be checked via ajax. It's a pain. Because most of your tests are simple regexes that can be run synchronously except for this one stupid ajax call to check if a username is available. So, just do this:\n\n```javascript\n// your field definition\n{\n  name: 'email',\n  label: 'Email',\n  tests: [\n    // BAM! add the `async` flag and your test will receive a third argument. A callback.\n    {\n      async: true, \n      test: function (email, formInstance, cb) {\n        $.get('/email-is-avail?val=' + email, function (data) {\n          cb(data === '1');\n        });\n      },\n      message: 'This email is already in use.'\n    },\n    // You can have simple synchronous tests alongside as well.\n    // and it still Just Works™\n    {\n      test: _.isEmail,\n      message: 'This doesn\\'t seem like a real email address'\n    }\n  ],\n  required: true\n}\n```\n\nIt's simple, but that's all for now. Because it works for what I need for this particular app. Contributions welcomed.\n\nCheers,\n\n \\- [@HenrikJoreteg](http://twitter.com/henrikjoreteg)\n\n##Gotchas\n\n - Still needs a bit more work/polish/testing.\n - Requires IE8 or newer because I didn't want jQuery as a dependency.\n\n##License\n\nMIT\n\n\n","_id":"reformer@1.2.0","dist":{"shasum":"e897a7c387e206f70fdbda5b0778efe5cbdb8d6a","tarball":"https://registry.npmjs.org/reformer/-/reformer-1.2.0.tgz","integrity":"sha512-sRQyNMl5UEDcPCeEfyj+7y9OhXBSFpn0b9ZjNHYZn/o3WMNPiIDBEkwXMxKLan2xcuuISnlG5MNFRzREQmGbBA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDDQUHidt8HmV47em2tqWwhPugHRk26YSp+hJuPIFdujAiBSzWahKNCSirKJP0aiEoBBG0l99cU0MeIQYtQzPE51Ag=="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"henrikjoreteg","email":"henrik@andyet.net"},"maintainers":[{"name":"henrikjoreteg","email":"henrik@andyet.net"}]},"1.3.0":{"name":"reformer","version":"1.3.0","author":{"name":"Henrik Joreteg","email":"henrik@andyet.net"},"description":"Super customizable, Self-contained, self-rendering, self-validating forms that can only output valid data.","dependencies":{"domify":"1.0.0"},"devDependencies":{"templatizer":"0.0.12","browserify":"2.25.0","uglify-js":"2.3.6"},"repository":{"type":"git","url":"https://github.com/HenrikJoreteg/reformer.git"},"keywords":["form","browser"],"main":"reformer.js","readme":"#reformer\n\nSelf-contained, self-rendering, self-validating forms that can only output valid data.\n\n##Step #1: Define your fields, with as many tests as you want for each field:\n\n```javascript\nvar f = new Reformer({\n  fields: [\n    {\n      name: 'first_name',\n      label: 'First Name',\n      placeholder: 'Something',\n      required: true\n    },\n    {\n      name: 'last_name',\n      label: 'Last Name',\n      tests: [\n        {\n          test: function (val) {\n            return false;\n          },\n          message: 'something will always go wrong'\n        },\n        {\n          test: function (val) {\n            return val && val.toString().length > 2;\n          },\n          message: 'Must be at least three characters.'\n        }\n      ],\n      required: true\n    }\n  ],\n  submit: function (vals) {\n    console.log(vals);\n  },\n  error: function (vals) {\n    console.log('error', vals);\n  }\n});\n```\n\n\n##Step #2: Render it once. It handles itself after that:\n   \n```javascript \ndocument.addEventListener('DOMContentLoaded', function () {\n  // render our form from about, just tell it where.\n  f.render({\n    formEl: document.getElementById('myform'),\n    fieldContainer: document.getElementById('fieldContainer'),\n  });\n});\n```\n\nReformer will handle form submit, and call your callback if everything's happy.\n\n##Bonus Step #3: Asynchronous validation\n\nYou know how you've always got that one field that needs to be checked via ajax. It's a pain. Because most of your tests are simple regexes that can be run synchronously except for this one stupid ajax call to check if a username is available. So, just do this:\n\n```javascript\n// your field definition\n{\n  name: 'email',\n  label: 'Email',\n  tests: [\n    // BAM! add the `async` flag and your test will receive a third argument. A callback.\n    {\n      async: true, \n      test: function (email, formInstance, cb) {\n        $.get('/email-is-avail?val=' + email, function (data) {\n          cb(data === '1');\n        });\n      },\n      message: 'This email is already in use.'\n    },\n    // You can have simple synchronous tests alongside as well.\n    // and it still Just Works™\n    {\n      test: _.isEmail,\n      message: 'This doesn\\'t seem like a real email address'\n    }\n  ],\n  required: true\n}\n```\n\nIt's simple, but that's all for now. Because it works for what I need for this particular app. Contributions welcomed.\n\nCheers,\n\n \\- [@HenrikJoreteg](http://twitter.com/henrikjoreteg)\n\n##Gotchas\n\n - Still needs a bit more work/polish/testing.\n - Requires IE8 or newer because I didn't want jQuery as a dependency.\n\n##License\n\nMIT\n\n\n","_id":"reformer@1.3.0","dist":{"shasum":"d0c0619d098d61e29c23cea7bab3c42d54c4965c","tarball":"https://registry.npmjs.org/reformer/-/reformer-1.3.0.tgz","integrity":"sha512-zlBblTnzfzHCv/uRAEfocR2Oq2BvwSTg0xiBS5wCZfUcOQlRgdnX2L/xMnmBxzX6vDNN/HMP+3XeHtPQe7+FXQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC5MlvCFS6rkqlIH98RXzvubTbK2z261kjW+RAuNLWiLwIgKyEL3vnLYiTfaJCR2zxuCv7nzzg3e7AUzxPDJ8j03oo="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"henrikjoreteg","email":"henrik@andyet.net"},"maintainers":[{"name":"henrikjoreteg","email":"henrik@andyet.net"}]},"1.4.0":{"name":"reformer","version":"1.4.0","author":{"name":"Henrik Joreteg","email":"henrik@andyet.net"},"description":"Super customizable, Self-contained, self-rendering, self-validating forms that can only output valid data.","dependencies":{"domify":"1.0.0"},"devDependencies":{"templatizer":"0.0.12","browserify":"2.25.0","uglify-js":"2.3.6"},"repository":{"type":"git","url":"https://github.com/HenrikJoreteg/reformer.git"},"keywords":["form","browser"],"main":"reformer.js","readme":"#reformer\n\nSelf-contained, self-rendering, self-validating forms that can only output valid data.\n\n##Step #1: Define your fields, with as many tests as you want for each field:\n\n```javascript\nvar f = new Reformer({\n  fields: [\n    {\n      name: 'first_name',\n      label: 'First Name',\n      placeholder: 'Something',\n      required: true\n    },\n    {\n      name: 'last_name',\n      label: 'Last Name',\n      tests: [\n        {\n          test: function (val) {\n            return false;\n          },\n          message: 'something will always go wrong'\n        },\n        {\n          test: function (val) {\n            return val && val.toString().length > 2;\n          },\n          message: 'Must be at least three characters.'\n        }\n      ],\n      required: true\n    }\n  ],\n  submit: function (vals) {\n    console.log(vals);\n  },\n  error: function (vals) {\n    console.log('error', vals);\n  }\n});\n```\n\n\n##Step #2: Render it once. It handles itself after that:\n   \n```javascript \ndocument.addEventListener('DOMContentLoaded', function () {\n  // render our form from about, just tell it where.\n  f.render({\n    formEl: document.getElementById('myform'),\n    fieldContainer: document.getElementById('fieldContainer'),\n  });\n});\n```\n\nReformer will handle form submit, and call your callback if everything's happy.\n\n##Bonus Step #3: Asynchronous validation\n\nYou know how you've always got that one field that needs to be checked via ajax. It's a pain. Because most of your tests are simple regexes that can be run synchronously except for this one stupid ajax call to check if a username is available. So, just do this:\n\n```javascript\n// your field definition\n{\n  name: 'email',\n  label: 'Email',\n  tests: [\n    // BAM! add the `async` flag and your test will receive a third argument. A callback.\n    {\n      async: true, \n      test: function (email, formInstance, cb) {\n        $.get('/email-is-avail?val=' + email, function (data) {\n          cb(data === '1');\n        });\n      },\n      message: 'This email is already in use.'\n    },\n    // You can have simple synchronous tests alongside as well.\n    // and it still Just Works™\n    {\n      test: _.isEmail,\n      message: 'This doesn\\'t seem like a real email address'\n    }\n  ],\n  required: true\n}\n```\n\nIt's simple, but that's all for now. Because it works for what I need for this particular app. Contributions welcomed.\n\nCheers,\n\n \\- [@HenrikJoreteg](http://twitter.com/henrikjoreteg)\n\n##Gotchas\n\n - Still needs a bit more work/polish/testing.\n - Requires IE8 or newer because I didn't want jQuery as a dependency.\n\n##License\n\nMIT\n\n\n","_id":"reformer@1.4.0","dist":{"shasum":"ece08fe4a850489aad4a79e0529aeddbbb6be4a6","tarball":"https://registry.npmjs.org/reformer/-/reformer-1.4.0.tgz","integrity":"sha512-Oy2r2PRT0PiAf68fqOi9tA9w9PcWRPiAPtudAxEtMi08D9kjb0nHtgTgpFz46IkFedJR/i4SavjyPyQ9QRHK0Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIA46Q9+Vw9oTxDOtQPno2SBD2gjVBD+76OUOM/2fvJRmAiEA8Cded7Zzi32cpelTyRTtWOb8PzV4b4T+agUhS9XSoic="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"henrikjoreteg","email":"henrik@andyet.net"},"maintainers":[{"name":"henrikjoreteg","email":"henrik@andyet.net"}]},"1.4.1":{"name":"reformer","version":"1.4.1","author":{"name":"Henrik Joreteg","email":"henrik@andyet.net"},"description":"Super customizable, Self-contained, self-rendering, self-validating forms that can only output valid data.","dependencies":{"domify":"1.0.0"},"devDependencies":{"templatizer":"0.0.12","browserify":"2.25.0","uglify-js":"2.3.6"},"repository":{"type":"git","url":"https://github.com/HenrikJoreteg/reformer.git"},"keywords":["form","browser"],"main":"reformer.js","readme":"#reformer\n\nSelf-contained, self-rendering, self-validating forms that can only output valid data.\n\n##Step #1: Define your fields, with as many tests as you want for each field:\n\n```javascript\nvar f = new Reformer({\n  fields: [\n    {\n      name: 'first_name',\n      label: 'First Name',\n      placeholder: 'Something',\n      required: true\n    },\n    {\n      name: 'last_name',\n      label: 'Last Name',\n      tests: [\n        {\n          test: function (val) {\n            return false;\n          },\n          message: 'something will always go wrong'\n        },\n        {\n          test: function (val) {\n            return val && val.toString().length > 2;\n          },\n          message: 'Must be at least three characters.'\n        }\n      ],\n      required: true\n    }\n  ],\n  submit: function (vals) {\n    console.log(vals);\n  },\n  error: function (vals) {\n    console.log('error', vals);\n  }\n});\n```\n\n\n##Step #2: Render it once. It handles itself after that:\n   \n```javascript \ndocument.addEventListener('DOMContentLoaded', function () {\n  // render our form from about, just tell it where.\n  f.render({\n    formEl: document.getElementById('myform'),\n    fieldContainer: document.getElementById('fieldContainer'),\n  });\n});\n```\n\nReformer will handle form submit, and call your callback if everything's happy.\n\n##Bonus Step #3: Asynchronous validation\n\nYou know how you've always got that one field that needs to be checked via ajax. It's a pain. Because most of your tests are simple regexes that can be run synchronously except for this one stupid ajax call to check if a username is available. So, just do this:\n\n```javascript\n// your field definition\n{\n  name: 'email',\n  label: 'Email',\n  tests: [\n    // BAM! add the `async` flag and your test will receive a third argument. A callback.\n    {\n      async: true, \n      test: function (email, formInstance, cb) {\n        $.get('/email-is-avail?val=' + email, function (data) {\n          cb(data === '1');\n        });\n      },\n      message: 'This email is already in use.'\n    },\n    // You can have simple synchronous tests alongside as well.\n    // and it still Just Works™\n    {\n      test: _.isEmail,\n      message: 'This doesn\\'t seem like a real email address'\n    }\n  ],\n  required: true\n}\n```\n\nIt's simple, but that's all for now. Because it works for what I need for this particular app. Contributions welcomed.\n\nCheers,\n\n \\- [@HenrikJoreteg](http://twitter.com/henrikjoreteg)\n\n##Gotchas\n\n - Still needs a bit more work/polish/testing.\n - Requires IE8 or newer because I didn't want jQuery as a dependency.\n\n##License\n\nMIT\n\n\n","_id":"reformer@1.4.1","dist":{"shasum":"4f9fe7611cc8f4e42fc6f052d5e32a9a90da64c2","tarball":"https://registry.npmjs.org/reformer/-/reformer-1.4.1.tgz","integrity":"sha512-48OGD7j+mlPSbsm8fjQBpIEeheEBhz6N8RDH3EY8R8s4YB2q3yIrx6ZDLeWSGOICe2aULssYg9+klYFWeDBQeg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD1YXsYccqmrZByzNxoPpKzOZrAkwdep8oMSdSCE+sJZwIhAL213EpanUIDiUakMHdNZVHGI9DfaC7NdDhqpobAqBmF"}]},"_npmVersion":"1.1.62","_npmUser":{"name":"henrikjoreteg","email":"henrik@andyet.net"},"maintainers":[{"name":"henrikjoreteg","email":"henrik@andyet.net"}]},"1.4.2":{"name":"reformer","version":"1.4.2","author":{"name":"Henrik Joreteg","email":"henrik@andyet.net"},"description":"Super customizable, Self-contained, self-rendering, self-validating forms that can only output valid data.","dependencies":{"domify":"1.0.0"},"devDependencies":{"templatizer":"0.0.12","browserify":"2.25.0","uglify-js":"2.3.6"},"repository":{"type":"git","url":"https://github.com/HenrikJoreteg/reformer.git"},"keywords":["form","browser"],"main":"reformer.js","readme":"#reformer\n\nSelf-contained, self-rendering, self-validating forms that can only output valid data.\n\n##Step #1: Define your fields, with as many tests as you want for each field:\n\n```javascript\nvar f = new Reformer({\n  fields: [\n    {\n      name: 'first_name',\n      label: 'First Name',\n      placeholder: 'Something',\n      required: true\n    },\n    {\n      name: 'last_name',\n      label: 'Last Name',\n      tests: [\n        {\n          test: function (val) {\n            return false;\n          },\n          message: 'something will always go wrong'\n        },\n        {\n          test: function (val) {\n            return val && val.toString().length > 2;\n          },\n          message: 'Must be at least three characters.'\n        }\n      ],\n      required: true\n    }\n  ],\n  submit: function (vals) {\n    console.log(vals);\n  },\n  error: function (vals) {\n    console.log('error', vals);\n  }\n});\n```\n\n\n##Step #2: Render it once. It handles itself after that:\n   \n```javascript \ndocument.addEventListener('DOMContentLoaded', function () {\n  // render our form from about, just tell it where.\n  f.render({\n    formEl: document.getElementById('myform'),\n    fieldContainer: document.getElementById('fieldContainer'),\n  });\n});\n```\n\nReformer will handle form submit, and call your callback if everything's happy.\n\n##Bonus Step #3: Asynchronous validation\n\nYou know how you've always got that one field that needs to be checked via ajax. It's a pain. Because most of your tests are simple regexes that can be run synchronously except for this one stupid ajax call to check if a username is available. So, just do this:\n\n```javascript\n// your field definition\n{\n  name: 'email',\n  label: 'Email',\n  tests: [\n    // BAM! add the `async` flag and your test will receive a third argument. A callback.\n    {\n      async: true, \n      test: function (email, formInstance, cb) {\n        $.get('/email-is-avail?val=' + email, function (data) {\n          cb(data === '1');\n        });\n      },\n      message: 'This email is already in use.'\n    },\n    // You can have simple synchronous tests alongside as well.\n    // and it still Just Works™\n    {\n      test: _.isEmail,\n      message: 'This doesn\\'t seem like a real email address'\n    }\n  ],\n  required: true\n}\n```\n\nIt's simple, but that's all for now. Because it works for what I need for this particular app. Contributions welcomed.\n\nCheers,\n\n \\- [@HenrikJoreteg](http://twitter.com/henrikjoreteg)\n\n##Gotchas\n\n - Still needs a bit more work/polish/testing.\n - Requires IE8 or newer because I didn't want jQuery as a dependency.\n\n##License\n\nMIT\n\n\n","_id":"reformer@1.4.2","dist":{"shasum":"507edd1a1d2d88c3506ccdd903c586675ec7a368","tarball":"https://registry.npmjs.org/reformer/-/reformer-1.4.2.tgz","integrity":"sha512-OiOoV/TdgOig4tFnmoul0SAZQq3z5sQMk/Wz+FSRGb8gwUXlUR/VJhOmW5g2dvg3Hv3UqaeTMcXiY6V6F8810w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCma2BOCPNTnX48M9TEmm+mR0d/43JDKroob5BKNrTtKgIgLJpzo9wJehSnq8c77nVjqyFefDWyhhjgdLsuFCvRDDA="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"henrikjoreteg","email":"henrik@andyet.net"},"maintainers":[{"name":"henrikjoreteg","email":"henrik@andyet.net"}]}},"readme":"#reformer\n\nSelf-contained, self-rendering, self-validating forms that can only output valid data.\n\n##Step #1: Define your fields, with as many tests as you want for each field:\n\n```javascript\nvar f = new Reformer({\n  fields: [\n    {\n      name: 'first_name',\n      label: 'First Name',\n      placeholder: 'Something',\n      required: true\n    },\n    {\n      name: 'last_name',\n      label: 'Last Name',\n      tests: [\n        {\n          test: function (val) {\n            return false;\n          },\n          message: 'something will always go wrong'\n        },\n        {\n          test: function (val) {\n            return val && val.toString().length > 2;\n          },\n          message: 'Must be at least three characters.'\n        }\n      ],\n      required: true\n    }\n  ],\n  submit: function (vals) {\n    console.log(vals);\n  },\n  error: function (vals) {\n    console.log('error', vals);\n  }\n});\n```\n\n\n##Step #2: Render it once. It handles itself after that:\n   \n```javascript \ndocument.addEventListener('DOMContentLoaded', function () {\n  document.querySelector('#something').appendChild(f.render());\n});\n```\n\n\nreformer will handle form submit, and call your callback if everything's happy.\n\n##Bonus Step #3: Asynchronous validation\n\nYou know how you've always got that one field that needs to be checked via ajax. It's a pain. Because most of your tests are simple regexes that can be run synchronously except for this one stupid ajax call to check if a username is available. So, just do this:\n\n```javascript\n// your field definition\n{\n  name: 'email',\n  label: 'Email',\n  tests: [\n    // BAM! add the `async` flag and your test will receive a third argument. A callback.\n    {\n      async: true, \n      test: function (email, formInstance, cb) {\n        $.get('/email-is-avail?val=' + email, function (data) {\n          cb(data === '1');\n        });\n      },\n      message: 'This email is already in use.'\n    },\n    // You can have simple synchronous tests alongside as well.\n    // and it still Just Works™\n    {\n      test: _.isEmail,\n      message: 'This doesn\\'t seem like a real email address'\n    }\n  ],\n  required: true\n}\n```\n\nIt's simple, but that's all for now. Because it works for what I need for this particular app. Contributions welcomed.\n\nCheers,\n\n \\- [@HenrikJoreteg](http://twitter.com/henrikjoreteg)\n\n##Gotchas\n\n - Still needs a bit more work/polish/testing.\n - Requires IE8 or newer because I didn't want jQuery as a dependency.\n - Won't really work with checkboxes/radioboxes and such, just yet.\n\n##License\n\nMIT\n\n\n","maintainers":[{"name":"henrikjoreteg","email":"henrik@andyet.net"}],"time":{"modified":"2022-06-26T10:39:50.582Z","created":"2012-09-14T17:07:37.454Z","0.0.1":"2012-09-14T17:07:39.169Z","0.0.2":"2013-01-14T08:41:06.874Z","0.0.3":"2013-01-24T08:30:18.934Z","0.0.4":"2013-01-24T18:24:40.395Z","0.0.5":"2013-03-27T20:39:04.193Z","1.0.0":"2013-07-12T08:35:16.216Z","1.0.1":"2013-07-12T18:17:54.101Z","1.1.0":"2013-07-12T20:12:14.824Z","1.1.1":"2013-07-16T17:45:40.488Z","1.1.2":"2013-07-16T18:07:24.191Z","1.2.0":"2013-07-22T21:05:38.829Z","1.3.0":"2013-07-23T16:48:44.666Z","1.4.0":"2013-07-23T18:50:11.550Z","1.4.1":"2013-07-23T19:34:40.013Z","1.4.2":"2013-07-23T23:04:49.526Z"},"author":{"name":"Henrik Joreteg","email":"henrik@andyet.net"},"repository":{"type":"git","url":"https://github.com/HenrikJoreteg/reformer.git"}}