Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Input components do not use value="" when the form data has a value #570

Open
schnittchen opened this issue Feb 24, 2022 · 1 comment
Open

Comments

@schnittchen
Copy link

schnittchen commented Feb 24, 2022

Describe the bug

How to reproduce it

  1. Have some data in the field being rendered
  2. <TextInput value="" />

The rendered does not have value="" but the value from the form data / changeset.
The functions in Phoenix.HTML.Form do not show this behaviour.

The behavior you expected

Expected the components to behave like Phoenix.HTML.Form.

Your Environment

Surface: v0.7.0
LiveView: v0.17.6
Elixir: v1.13.0

Edited because HTMLish content needs to be fenced, otherwise <TextInput... becomes invisible ;)

@miguel-s
Copy link
Collaborator

miguel-s commented Mar 2, 2022

Hi @schnittchen!

Thanks for reporting, I can reproduce the issue. On first glance it seems to be caused by Surface's handling of empty strings in props.

In the meanwhile as a workaround you can pass the value through the opts like so <TextInput opts={value: ""} />. All opts are passed directly to the Phoenix.HTML.Form.text_input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants