Is there a supported way to close the currently open modal from a custom button inside the modal content

Hallo, I’m trying to close a modal from a custom button inside the modal content, not with the built-in close button.

My use case is: a button inside the modal named “save&close“ run several actions first, then close the currently open modal at the end.

For example, I want the button “save&close” to do that:

creates a tiddler, updates some fields or tags, clears temporary tiddlers, and finally closes the modal.

So my actual question is: Is there a supported way to close the currently open modal from a custom button inside the modal content (after running multiple actions)?

eron

Within the modal content, <<currentTiddler>> refers to the tiddler that defines the modal. Thus, you an use something like this:

<$button message=tm-close-tiddler actions="...">
   save and close
</$button>

Note also that, if you really want to clean up after yourself, your actions can also invoke

<$action-deletetiddler $tiddler=<<currentTiddler>>/>

to remove the modal tiddler itself.

The following demonstrates the technique:

<$let modal="$:/temp/myModal">
<$button message=tm-modal param=<<modal>>>
   open modal
   <$action-setfield $tiddler=<<modal>>
      subtitle="modal title"
      text="""
         modal content goes here
         <$button message=tm-close-tiddler actions="... save actions go here...">
            save and close
         </$button>
      """>
</$button>

Let me know how it goes…

-e

Perfect — my apologies, I didn’t see it in the documentation. On the other hand, even now that I’ve read it, I still wouldn’t have associated it with modals either.
Best regards, and have a restful weekend! And thanks again.