8
uyouthe
12d

Sometimes we just need simple solutions like this one

https://github.com/uyouthe/formie

Comments
  • 1
    Interesting.

    What's the use case and problem that you are trying to solve?

    #Curious
  • 1
    This is beautiful, when i was a web dev, I hated writing code to get data from forms.
  • 1
    "a little copying is better than a little dependency"
  • 1
    @Floydimus I want not to write a separate getElementById for every input, I want to get the entire form as json on submit. That’s the idea
  • 1
    Fuck im grabbing that.
  • 3
    I'd use this! And a good license 👌
  • 0
    @Ranchu @linuxxx thanks!
  • 1
    It’s not like that you can get all form values as object and spit it out with JSON.parse ...

    NAH, WAY TO COMPLICATED, I NEED A SEPERATE LIBRARY FOR IT

    Fuck off
  • 0
    @010001111 you can get all the form as json on the frontend with no backend? How? Please enlighten me, I really don’t know
  • 0
    @uyouthe new FormData and use Iterators. If you’re lazy just use Array.from and map the 2d k/v Array to an object.

    Also raise a proper exception when the wrong arguments were supplied.

    I’d also use a switch for each input type.

    Callbacks are neat to deal with, but I’d also would use a Promise nowadays (unless you intend your dependants to support the ugly ie and don’t wanna burden them the need of polyfills).
  • 0
    @010001111 oh. Thanks. Didn’t knew that
  • 0
    @010001111 you know what, I tried using formdata and the code that actually returns a json and also handles multiselects and other quirky things is barely shorter. So no, formie is still relevant
Add Comment