Way to stop propagating events

Hi, I want to implement a custom component using live view, which consists of a number of input elements, the result from the form will be part of hidden element, so it could be handled like any other input element in form. The problem is, I’want to prevent events to propagated outside of the custom component, which produces unnecessary server road trips, especially buttons, which produces meaningless „submit“ events in the surround form (form_for), even when a dedicated submit exists.

is there another possibility to prevent propagating events beside installing event listener for all possible events to stop propagating them ?

phoenix 1.6, phoenix_live_view 0.16.4

For buttons inside a form you can use <button type="button">...</button> to prevent them from submitting.

sorry, my fault, I’ve created button elements using <button> without the type attribute, so the default type will be submit. After changing the type to button, catching just ‘click’, ‘blur’, ‘change’ and input is enough

thanks for pointing this, out, I was already typing my own response :slight_smile: