Giter Site home page Giter Site logo

formee's People

Contributors

emiltholin avatar krismuniz avatar lukeed 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  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  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  avatar  avatar

formee's Issues

Nested keys example for Readme

To show usefulness of validating a single object with nested keys rather than lots of individual vars

<input type="text" name="address.town">
...
<input type="text" name="address.postalcode">

Then the rules:

getRules(){ 
   const result = { 
   ['address.town'](val) { 
   ... return valid
   }
  ['address.postalcode'](val) { 
   ... return valid
}

File Inputs

Currently file inputs are ignored โ€“ this was because handling File objects is usually very application-specific and validating them can be their own nightmare.

However, I've realized that the validation aspect is a moot point because you (the user) pass in your own validation rules, and formee will just respond to what your Functions & RegExps return values.

The only remaining "gotcha" is that the serialized return can no longer be passed directly into current fetch() requests if you have a File present. With the current formee version, tge data would just not include the file(s), making it safe for basic POST requests.

In order to upload files now, you have to manually check the DOM for values within your file inputs, and then upload them in a separate POST request or transform the current, single POST into a multipart request.

If formee were to serialize & validate file inputs, the only difference is that you'd have to check against the serialized data instead of adding to the serialized data. The cause for concern is that you may unknowingly attempt to send basic POST requests with multi-part bodies.

Either way, you have to formulate your outgoing HTTP request properly.


Edit: I should clarify that an object will still be returned, not a FormData instance.

Another (existing) shortcoming is that asynchronous validation methods won't be awaited. This is true for all validators currently, too, but may be highlighted with file validation.


What do you think? Should formee serialize & validate file inputs?


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.