Skip to content

Change checkbox input to a text input #1016

Closed

Description

@jenweber

This issue is good for beginners. Read Making your first pull request and ask for help if you run into issues! Experienced contributors are asked to search for other things to fix.

In this guide we show using a keyPress event with a checkbox. That seems odd since a click will not trigger updates.

Replace this example with a text input, try it in an app to see if it works, and open a PR with the change. Make sure to check the written sections around the example to see if any of the explanations need to be changed too.

Here's the example that needs to be refactored:

<Input @type="checkbox" @keyPress={{action "updateName"}} />

Something like this will work:

<Input @type="text" @keyPress={{action "updateName"}} />

Activity

  1. added
    help wanted
    good first issue
    on Aug 23, 2019
  2. asbillings07 commented on Sep 21, 2019

    @asbillings07
    Contributor

    Could I take a stab at fixing this one?

  3. acorncom commented on Sep 21, 2019

    @acorncom
    Member

    @asbillings07 please do!

  4. asbillings07 commented on Sep 21, 2019

    @asbillings07
    Contributor

    Awesome. Will get started on it. Thanks!

  5. added a commit that references this issue on Sep 21, 2019
  6. jenweber commented on Oct 2, 2019

    @jenweber
    ContributorAuthor

    (oops, wrong thread, this doesn't count for Hacktoberfest, but we'd love for you to participate)

  7. ab-develops-ads commented on Oct 2, 2019

    @ab-develops-ads

    Ah okay. I'll take a look at another one I can submit a PR for.

  8. added a commit that references this issue on Nov 16, 2019
  9. prathamesh-borse commented on Jan 3, 2021

    @prathamesh-borse

    can i work on this issue now?

  10. ijlee2 commented on Jan 3, 2021

    @ijlee2
    Member

    Hi, @viraldevpb. Thanks for wanting to help out with this issue!

    I noticed that the issue is a bit outdated and its description needs to be updated. Currently,

    1. The Built-in Components page, in versions 3.15 - 3.23, shows the correct usage of checkbox inputs.
    2. The Input Helpers in versions 3.7 - 3.13, as well as Input Components in version 3.14, can use an update.
    3. We don't need to change Input Helpers for versions 3.6 and below, because it doesn't talk about how to bind an action to a checkbox input.

    TODOs

    1. Input Components page (v3.14)

    2. Input Helpers page (3.7 - 3.13)

    • Update the code {{input type="checkbox" keyPress=(action "updateName")}} to:

      {{input type="checkbox" name="isAdmin" checked=this.isAdmin input=(action "validateRole")}}

      Note, name="isAdmin" is kept intact.

    Notes

    Can you make 2 commits for your pull request, one for v3.14 and another for v3.7 - v3.13. This will help with the review.

    Thanks, and let me know if you have any questions!

  11. arshibhatt-cs commented on Mar 28, 2021

    @arshibhatt-cs
    Contributor

    Is there any work remaining to be done for this issue ? I can take a stab at it. Thanks

  12. ijlee2 commented on Mar 28, 2021

    @ijlee2
    Member

    Hi, @ejfian-2020. Thank you for making time to help out with the issue.

    Yes, I think the 2 TODOs listed in my comment above (Jan 3, 2021) are yet to be done. Could you help out with updating the code examples for Ember 3.7 - 3.14?

    If a code example shows angle brackets, please use the angle bracket syntax. If curly braces, keep the curly brace syntax. If you have any questions, please let me know!

  13. arshibhatt-cs commented on Mar 29, 2021

    @arshibhatt-cs
    Contributor

    Hi @ijlee2,
    Just so that i understand the asks correctly. This change needs to be done for all the versions of Ember from 3.7 to 3.14 , is that correct ?
    Based on your recommendations I will create 2 commits in the PR one for the v3.14 and another for v3.7- v3.13.

  14. arshibhatt-cs commented on Mar 29, 2021

    @arshibhatt-cs
    Contributor

    Hi @ijlee2 ,
    For v3.10 - v3.13 , the code is using angle brackets and removing the @name="isAdmin" , I will change the
    <Input @type="text" @keyPress={{action "updateName"}} />
    to

    <Input @id="admin-checkbox" @type="checkbox" @checked={{this.isAdmin}} @input={{this.validateRole}} />

    Please confirm if the change looks good.

  15. added a commit that references this issue on Mar 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

good first issuehelp wanted

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions