Phx-change is not triggered when changing the value using javascript

I am using a library to get user input, when the custom input changes an event is triggered to change the form input.

$("#my-input").on("change", function (e) {

but phx-change="validate" is never triggered, I tried to do this manually, and change the value using javascript


phx-change="validate" is not triggered, so I need a way to trigger the phx-change, I tried to dispatch an event but (if I did it right) I think it didn’t trigger the phx-change="validate" either.

So, can you point out to the problem or to the solution?

Yes, you’re gonna have to trigger form events explicitly in these cases. Check this out: triggering-phx-form-events-with-javascript

1 Like

thanks, it worked

1 Like