Skip to content

[LiveComponent] ComponentWithFormTrait out-of-sync with browsers’ changes #1958

Open
@MatTheCat

Description

While working with symfonycasts/dynamic-forms I observed two issues which seem to stem from the same cause:

  • A not-expanded ChoiceType without placeholder whose value is null will appear as a <select> with the first <option> selected. The state of the component is then out-of-sync.
  • When refreshing a page with a form, browsers will populate fields with the value the user previously changed. As this happens without any user interaction, the component won’t be aware of these changes and will keep its default state.

The first issue can be worked around by adding a placeholder, and the second by setting to the fields which must keep their value the autocomplete attribute to off.

Maybe the component could react to the load event to update its state?

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions