Programmatically open a form

Is it possible to programmatically open a specific form on the sidebar or as a screen? Let’s say my page has very many forms so that scrolling them in a list is no good, but my page has built-in search/filtering functionality - could I add a button to each item that opens the specific form corresponding to that item?

1 Like

Hey @ervin! That’s currently not possible with the sidebar but it’s a great idea!

I’m thinking maybe an API like

cms.sidebar.setActiveFormId(someForm.id)

const activeFormId = cms.sidebar.getActiveFormId()

And then that could also dispatch an event:

cms.events.subscribe('sidebar:setActiveForm', ({ activeFormId }) => {
  console.log("Opening Form", activeFormId)
})

If we work out some ideas maybe we can make a little RFC

This sounds like a great idea. As a suggestion, this method/event should take an optional prop to specify the display.

If it isn’t set, a sidebar. If it is set, this could display as a screen with all of the display modes available to screens in the future.

1 Like

That feels like a different thing to me but I like it as well.

That is, in this case we’re talking about the Active Form Plugin but you’re talking about triggering an Active Screen Plugin