Skip to content

[Live Components] Reach a specific LC method when input change? #2174

Closed Answered by SosthenG
Nayte91 asked this question in Questions & Answers
Discussion options

You must be logged in to vote

Hi!

If I understand correctly, you want to make a call to a method of your LC when your input has changed and display something depending on the content?
If so you should be able to do the following:

<div{{ attributes }}>
    {{ form_start(form) }}
    {{ form_row(form.myval, {
        attr: {
            'data-action': 'change->live#action',
            'data-live-action-param': 'something'
        }
    }) }}
    {{ form_end(form) }}
    <span>{{ customText }}</span>
</div>
<?php

namespace App\Twig\Components;

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\FormInterface;
use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
use Symfony\…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@Nayte91
Comment options

@SosthenG
Comment options

@Nayte91
Comment options

Answer selected by Nayte91
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants