Skip to content

Fields with "value" attributes become uneditable after transform #14

Closed

Description

@ssorallen

In order for "value" to behave as it does in HTML, the created React components must use "defaultValue". "value" in React creates a controlled component, which makes react-magic generate un-editable inputs.

Currently:

> converter.convert('<input value="Darth Vader">')
"<input value="Darth Vader" />
"

To behave as expected:

> converter.convert('<input value="Darth Vader">')
"<input defaultValue="Darth Vader" />
"

Activity

  1. ssorallen commented on Jan 7, 2015

    @ssorallen
    ContributorAuthor

    The same goes for type="checkbox" with the checked attribute. It should be converted to defaultChecked.

  2. aboobakkar commented on Feb 1, 2017

    @aboobakkar

    the above same issue for me.. and i also checked article https://themeteorchef.com/tutorials/click-to-edit-fields-in-react and deafultValue is not worked thsi,state.something value

  3. aayushis12 commented on Jun 13, 2017

    @aayushis12

    The same issue is with me. My Codepen link is https://codepen.io/asinha/pen/EXaZJm?editors=1111 , when I set getInitialValue to '' the input box becomes non-editable

  4. luanlucho commented on Aug 23, 2018

    @luanlucho

    Same issue!

  5. satishchadokar commented on Oct 5, 2018

    @satishchadokar

    Same issue for input

  6. Virksaabnavjot commented on Dec 8, 2019

    @Virksaabnavjot

    same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ Proxy