Forum Academy Marketplace Showcase Pricing Features

Trigger custom event from reusable element?

I have an “edit bar” that I reuse for different data types. It has an edit, save and close buttons.
When the “save” button is hit, I want the parent item to save itself (make changes to database). It feels like custom events is the way to do this but I cannot figure it out.

I assume it would work this way:

  1. create a “saveItem” custom event (where should this be created)
  2. trigger the “saveItem” custom event from the edit bar
  3. watch this custom event from one of my item pages and perform save when it fires

I created the custom event from my item page and the actions are to save the item.

From my reusable element, I would think I could fire this custom event but it doesn’t show up as selectable

bump. Am I missing something here?

Custom events are only accessible from the workflow page on which they were created, so the custom event would need to be inside the reusable element.

thanks @romanmg.
So my use case:

  1. reusable editbar that can be used on different types of thing pages. This edit bar has among other things, a “save” button.
  2. editbar tells the page that the save button has been pressed and the containing page saves itself

Can this be done with custom events?

Off the top of my head, I think you’d need to set a bunch of conditions based on what page you’re on so that the correct data is read and saved. Saving different things this way from a reusable element seems like you may need to get creative and might end up creating regular events - though I completely see why you want to do it this way. I’ve only used REs for navigation, menus, and workflows that stay contained within the RE. I want to answer more confidently, but will have to get back to you tomorrow!

I have a feeling what you’re really needing is a custom reusable event! I’ve seen it brought up before on the forum, and that out-of-the box feature isn’t offered… to my knowledge at least.