Code Monkey home page Code Monkey logo

Comments (4)

nikku avatar nikku commented on August 13, 2024 2

If we do it inside the form library, we need to be 100% sure on the semantics. Let us consider the following scenarios where I added my expected output. To summarize: Every visual field should always yield an output with empty fields turning into an empty output. Everything that is invisible does not yield an output.

Input data Action Expected output (submitted value)
{} submit { creditor: '' }
{ creditor, foo } { creditor }
{ creditor } creditor field cleared { creditor: '' }
{ creditor } creditor not renderered (cond. rendering) { }

Future work in this area is expected, cf. #6, too.

from form-js.

nikku avatar nikku commented on August 13, 2024

Thanks for opening this issue. An interesting case, indeed.

Does it make sense to do the diffing outside the form library? Or is this something that should strictly be handled inside the form library?

from form-js.

marstamm avatar marstamm commented on August 13, 2024

I think it would make more sense to have the diffing inside the form library. Would it make sense to always include all fields, even when they are untouched and empty? This way, it is clear what fields are present in the form.

For the diffing to work outside of the library, we would also need a utility function to know which keys/variables are used in the form. Currently, we sometimes pass data into the form that is not used by the form. These unrelated variables should not be cleared as a side effect.

from form-js.

nikku avatar nikku commented on August 13, 2024

One further thing to consider: How to handle fields that do not have a natural string based default value, e.g. dates or number inputs? It likely makes sense to have mandatory either a default value or that the field is required.

Alternatively we'd need to re-consider #54 (comment).

from form-js.

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.