Skip to content

[LiveComponent] How to set the value of an input field within a modal-live-component when the modal is opened? #1625

Closed
@momocode-de

Description

@momocode-de

I tried the following demo for a bootstrap modal: https://ux.symfony.com/demos/live-component/product-form

It works quite well, but I have a question. I have a list of items on my page and each item has a button that should open the modal. In the modal there should be a form that contains a hidden input with the ID of the item. There are also two text fields. If I render the modal in every item, this is not a problem. But that wouldn't be so nice if the modal is rendered in every item just because it has to contain the ID of the item in the hidden input. So my idea would be to include the modal in the template once under the list. Is there a smart way to set the value of the input field when the button is clicked, i.e. when the modal is opened?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions