Coder Social home page Coder Social logo

Comments (3)

anddoutoi avatar anddoutoi commented on June 1, 2024

I really like the gist of this idea. We sometimes (using React/Redux) store a full FormData instance in the store and it would be very convenient if we could just take props.formData and apply it to a <form>. The contract would be very strong in this case. Now we do this in a custom way.

I'm not sure I like the getter/setter approach and I generally prefer not to dabble with built-in prototypes even if it's supported by most UAs today. This operation could be "costly" and a function/method call shows this better then just a setter. Using a function also enables you to have an optional iteratee handler if you need to make something custom.

I also guess that the scope needs to be limited to static forms and the handling of dynamically added form controls and values can be considered in a 2.0.

from formdata.

jimmywarting avatar jimmywarting commented on June 1, 2024

I want to built it independent of any framework (jQuery, Angular, React, Vue) so it can work in any project.

I'm still wondering if you sometimes need a custom iteratee handler. or if you need custom options.
The way it should work is just doing the opposite thing to what new FormData(form) dose

I was also thinking what if the element don't exist? should it create a <input type="hidden"> with it's value? or only assign it to the element that dose exist.

from formdata.

anddoutoi avatar anddoutoi commented on June 1, 2024

Agree on that is should be completely framework agnostic. I was just emphasising how we are using FormData (and by that, this polyfill).

I was also thinking what if the element don't exist? should it create a with it's value? or only assign it to the element that dose exist.

Kind of depends of the purpose of the feature. To fill in a form from a FormData object or make a 1-to-1 mapping for network transport?

In a first version I would say that it should not mutate the markup or try to do some "smart things".

from formdata.

Related Issues (20)

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.