Giter VIP home page Giter VIP logo

Comments (4)

erikras avatar erikras commented on May 13, 2024

Great question. This is a common source of confusion. 👍

For that, you must specify an initial value. For example, look at the checkbox in that example. If it wasn't initialized, then, once it's clicked it would only ever be true or false, and never undefined, so it will never get back to pristine. Radio buttons, when properly designed, are the same way. That was an oversight of mine in making that example.

Does that make sense?

from react-final-form.

Gi972 avatar Gi972 commented on May 13, 2024

Thanks for your explanation @erikras

I had not seen the initialvalue properties ^_^'

Thanks again.

from react-final-form.

pantchox avatar pantchox commented on May 13, 2024

Hi @erikras
From the classic simple example i found that pristine does not work on multiple checkboxes

https://codesandbox.io/s/xjw9r381wp

in this example i added to initialValue object empty sauces array.
When i check and then uncheck it returns to initial values, but the submit button returns to be non disabled.

is this intentional or a bug?

Also if this is a bug, in the docs it says pristine does shallow compare.
Meaning that is the initial values of sauces array was 2 selections, playing with the checkbox can select them both in a diffrent order in the array.
that should also make pristine set as true (?)

thanks.

from react-final-form.

lock avatar lock commented on May 13, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

from react-final-form.

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.