Giter Site home page Giter Site logo

form-to-object's People

Contributors

jackmoore avatar jonathanong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

form-to-object's Issues

Doesn't seem to work with multi-selects

Using a <select multiple='multiple'>. When more than one value is selected, form-to-object only includes one of the selected values, not all of them.

This reproduces the error:

Javascript

const formToObj = require('form-to-object')
const formEl = document.querySelector('#theForm')
const params = formToObj(formEl)
console.log(params)

HTML

<form id='theForm' action='' method='post'>
  <input type='hidden' name='blah' value='something' />
  
  <select multiple='multiple' name='theMulti'>
    <option value='First Choice' selected='selected'>First Choice</option>
    <option value='Second Choice'  selected='selected'>Second Choice</option>
    <option value='Third Choice' >Third Choice</option>
  </select>
</form>

Output

{blah: "something", theMulti: "First Choice"}

Expected

I would expect something like:

{blah: "something", theMulti: ["First Choice", "Second Choice"]}

transfer

@jackmoore can you delete your fork of the same name so i can transfer this repo to u? thanks

Handle readonly attributes as well as disabled ones

Great library - small, powerful and few dependencies.

However, it submits readonly form fields to the server.

It seems to handle disabled fields just fine and should require just a few additional not(:read-only) selectors to correctly ignore these fields.

Just a thought.

NPM package not working

The package form2obj on NPM is not working, the index.js file only contains this:

module.exports = require('./lib/form2obj');

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.