Giter Site home page Giter Site logo

Comments (14)

bluebill1049 avatar bluebill1049 commented on July 19, 2024 1

you are right @hbarcelos i will adjust the code soon 👍

from input.

bluebill1049 avatar bluebill1049 commented on July 19, 2024 1

fork and submit a PR would be perfect :)

from input.

bluebill1049 avatar bluebill1049 commented on July 19, 2024 1

ah cool! Whenever you are free man no pressure. Sorry tagged you twice 😅

from input.

bluebill1049 avatar bluebill1049 commented on July 19, 2024

I will take a look at this soon :)

from input.

hbarcelos avatar hbarcelos commented on July 19, 2024

I think I've found the problem here:
https://github.com/react-hook-form/react-hook-form-input/blob/master/src/index.tsx#L6

This line:

return target ? (isCheckbox ? target.checked : target.value) : target;

If we have a checkbox, it always returns the checked properties, regardless value is set or not.

To be consistent with the way react-hook-form works, it should return a value based on the following algorithm:

If `checked` is `false`:
  Then return `false`
Else if `checked` is `true`
  If `value` is non-empty
    Then return `value`
  Else
    Then return `true`

I've updated the linked sandbox to demonstrate this.

from input.

bluebill1049 avatar bluebill1049 commented on July 19, 2024

actually you interested to contribute? you already know the solution :)

from input.

hbarcelos avatar hbarcelos commented on July 19, 2024

Sure. How can I do that? Should I fork and submit a PR or would you give me some permissions for this repo?

from input.

jtoliver avatar jtoliver commented on July 19, 2024

Anything new on this. I took a stab at it today with no success. I'm trying to do grouped checkboxes with same name.

from input.

bluebill1049 avatar bluebill1049 commented on July 19, 2024

@jtoliver i believe @hbarcelos is looking into this.
@hbarcelos any update on this PR? I am happy to take a look this over the weekend tho.

from input.

hbarcelos avatar hbarcelos commented on July 19, 2024

@bluebill1049 sorry for the delay... Busy week. I'll have some time during the weekend.
It is quite an easy fix to do, but I would want to add some regression tests as well, so this could take a little bit longer than editing 1 or 2 lines.

from input.

bluebill1049 avatar bluebill1049 commented on July 19, 2024

awesome! thanks @hbarcelos

from input.

bluebill1049 avatar bluebill1049 commented on July 19, 2024

hey @hbarcelos, wondering if any update on this issue?

from input.

bluebill1049 avatar bluebill1049 commented on July 19, 2024

going to close this issue for now, unless someone encounter similar problem.

from input.

hbarcelos avatar hbarcelos commented on July 19, 2024

Hey, I'm sorry... This has being a pretty busy end of year for me. I'll try to work on this before x-mas though.

from input.

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.