Giter Club home page Giter Club logo

Comments (10)

brainfoolong avatar brainfoolong commented on June 14, 2024 1

Hm, are your sure? It's set to false by default, i've double checked the tests, minified and not minified version of the current v2 branch.

from form-data-json.

KES777 avatar KES777 commented on June 14, 2024 1

I am sorry. I pull, but forget to copy dist to my directory =)
It works thank you.

from form-data-json.

brainfoolong avatar brainfoolong commented on June 14, 2024 1

The good/bad situation of this standard really depends on what forms you generate. The case also only applies for non indexed/autoincrement keys in checkboxes, which is an edge case. To break compatibility with other software/v1 just for this very special case is not a good decision. Correctly indexed keys eg.: chk[foo] still can be used in fromJson()

I can think of both good reasons for this behaviour and also for bad reasons.

If you really don't want this behaviour, it is an easy one-liner to make it globally.

FormDataJson.defaultOptionsToJson.uncheckedValue = false

from form-data-json.

brainfoolong avatar brainfoolong commented on June 14, 2024 1

Thanks for your feedback, i close this.

from form-data-json.

brainfoolong avatar brainfoolong commented on June 14, 2024

Good point. This is a tricky situation. I consider this a problem that native solutions never have fixed.
Generally, this library should do pretty much the same thing as native FormData and PHP by default and both do the same, they only make an array of the checked elements. If first is not checked, you loose the information to restore the form from given data.

But, i agree. This should be false by default, to workaround this issues of native behaviours.

Will be changed.

from form-data-json.

brainfoolong avatar brainfoolong commented on June 14, 2024

Thx for report.
Changed as suggested in 2.0.3beta

from form-data-json.

KES777 avatar KES777 commented on June 14, 2024

does not work for commit:0361d0a

image

from form-data-json.

brainfoolong avatar brainfoolong commented on June 14, 2024

Thanks for your tests.

from form-data-json.

brainfoolong avatar brainfoolong commented on June 14, 2024

Ok, i have to really undo this. This behaves so differently to all standards, this is not good. In all standards (Browser, FormData, PHP, etc...) unchecked checkboxes are simply not submitted.

This library should do the same by default, i undo this in the beta to "undefined", it must be like that in my opinion.

Even if that mean, that you cannot use the result in fromJson() when not setting uncheckedValue by hand to null or false.

from form-data-json.

KES777 avatar KES777 commented on June 14, 2024

IMHO: We see that standard behavior is ugly. There are tons of workarounds for this "standard" behavior...
Never understand why this "standard" must be by default if first thing will be escaping from it, workaround, etc.?
If this standard send broken data which gives nothing, why we should send it at all?

If you count that this library should be same by default, then I will not defend my opinion.
Also I does not support this "standard" default. ;-)

from form-data-json.

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.