What I’m trying to do: I wan to add a click event to a card component. I’ve read the document on custom component and custom events but its not clear how to achieve what I want.
What I’ve tried and what’s not working: I’ve tried to set the click event on a card component using the add_event_handler function but its throwing the error: " Cannot set event handler for unknown event ‘click’ on undefined component. Custom event names must start with ‘x-’. at [Form1, line 21](javascript:void(0))" .
your custom component needs to raise the click event somewhere. Currently the custom component doesn’t raise the click event. Since it doesn’t raise a click event then the click event will never fire, and so your function custom_form_1_click will never have a click event to handle.
Your second suggestion works well for what I needed. Thanks so much.
Your first suggestion of raising the click event on the init of the custom form raised the error " ValueError: Cannot raise event for unknown event ‘click’ on undefined component. Custom event names must start with ‘x-’. at [CustomForm, line 10](javascript:void(0))". For my education, could you explain how best to resolve this? thanks again!