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

TextField value should reset when defaultValue property changes #1420

Closed
2 tasks done
prakhargupta1 opened this issue Dec 6, 2022 · 2 comments · Fixed by #1434
Closed
2 tasks done

TextField value should reset when defaultValue property changes #1420

prakhargupta1 opened this issue Dec 6, 2022 · 2 comments · Fixed by #1434
Assignees
Labels
bug 🐛 Something doesn't work feature: App Editor

Comments

@prakhargupta1
Copy link
Member

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Summary 💡

Use case: I want to update some values of a datagrid through a form. So I expect the values of selected row should prefill in the form. The ideal component inside a form for this function is TextField, but I can't bind a value to it. It seems to only take input.

Default value property also doesn't serve the purpose.

App link

Examples 🌈

No response

Motivation 🔦

No response

@prakhargupta1 prakhargupta1 added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 6, 2022
@bytasv
Copy link
Contributor

bytasv commented Dec 6, 2022

Seems that the issue is caused when we modify input and set value prop, upon changing selection value is not cleared. Since value itself can not be bound - I'm wondering if it made sense if we added logic which would clear value when defaultValue changes? 🤔 @Janpot any thoughts on this? Or maybe you see a better way?

image

@Janpot
Copy link
Member

Janpot commented Dec 6, 2022

Did a little benchmark in other tools on how they handle this. The benchmark was:

  • create two inputs
  • make the second input default value equal to the first ones value
  • type in the first input, then type in the second input, then type in the first one again

retool, appsmith, openblocks and dynaboard all behave the same. When the default value changes, the input value is reset to the default value.

I'm fine with adopting the same behavior

@Janpot Janpot changed the title Allow bindings in the textField component TextField value should reset when defaultValue property changes Dec 6, 2022
@Janpot Janpot added bug 🐛 Something doesn't work feature: App Editor and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Dec 6, 2022
@bytasv bytasv self-assigned this Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work feature: App Editor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants