Sending Messages to user in Browser

Folks,

As far as I can see all the ways to message users in the browser such as notify, popups, alerts and modals all require second tiddler to format the display.

Is there any other way to present a timed or dismissible message to the user without another tiddler?

I want the ability to quickly inform the user within buttons and actions however the ActionLogWidget only writes to the console.

I would like to use it for design and debugging then in the final solution, as a result I do not want to create a “message tiddler” every time.

[Edited} See Solution and observed bug?

You only need to provide a template, that can be filled with variables.

Create a test-notify tiddler

\define testAction()
<$action-sendmessage $message="tm-notify" $param="notify" var1="This is" var2="a test" var3="This is" var4="in a new line" var5="This is" var6="in the 3rd line" />
\end

<$button actions=<<testAction>> >test</$button>

Create a notify template eg:

<<var1>> - <<var2>><br/>
<<var3>> - <<var4>><br/>
<<var5>> - <<var6>>

and have fun!
mario

3 Likes

Thanks @pmario for this answer however I am looking for a momentary message as seen with the Save Wiki button, small yellow box that leaves in a short time.
*A little research suggests this is in Javascript only.

  • Someone who knows javascript should be able to write a short javascript macro with a parameter for the message.
  • No intermediate tiddler is needed, or desired.
  • Being able to set the timeout period would be nice.
  • Rendering the message first would be even better to allow links etc…but not essential.

That’s exactly, what the code above does. … Did you try the code?

There is no JS needed. …

2 and 4 are connected. If a template is used rendering is free, because that’s what showing the template does.

3 would be a new feature request at GH for the tm-notify message.

Thanks @pmario I saw your notify message in use and had one of mine written already and it was not working.

Sorry, I tried yours and it works strait away, must have being a typo.

Ta Muchly.

I also discovered an artefact, if not a bug;

  • Assume the “notify” tiddler contained the appropriate variable <<message>> or <<content>>.

This will fail,
<$action-sendmessage $message="tm-notify" $param="notify" message="My Message" />
This will not
<$action-sendmessage $message="tm-notify" $param="notify" content="My Message" />

This is why I asked what appeared to be a “stupid question”.

It works for me. There may be a typo in the “notify” tiddler