# Buttons, messages, topics and weird things with messages

**URL:** <https://discourse.nodered.org/t/buttons-messages-topics-and-weird-things-with-messages/15220>\
**Category:** Dashboard\
**Created:** [7 September 2019 02:43 UTC](https://discourse.nodered.org/t/buttons-messages-topics-and-weird-things-with-messages/15220 "2019-09-07T02:43:12Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [7 September 2019 08:51 UTC](https://discourse.nodered.org/t/buttons-messages-topics-and-weird-things-with-messages/15220/6 "2019-09-07T08:51:08Z")

</div>

> [@Steve-Mcl](#):
>
> Some questions on your code and design ...
> 
> - why are you generating HTML in the FB? Why not send `colour` and `icon` as properties of payload - then use a template in the value field. No need for a function block at all.
> - Why are you always creating a new `msg` , just update the one that comes in to the function. This has several benefits (e.g. less wasteful, you can track how things change as it travels through your flow)
> - Why are you escaping the quotes? `\"` it is unnecessary.

Hi.

Oh dear. To answer.  
1 - I think that is only for the sake of showing what I was chasing for hours.  
The real flow is a lot bigger and _complex_. If you want I can post it to you but it needs a few external nodes.  
2 - Thanks. But I am not sure it is _applicable_ for all cases. In this case could you show how it would be different to what I did?  
3 - I'll get back to you on that soon.  
This is all part of a new schema to which I have been introduced.  
Obviously there is a problem somewhere in there either in how I was told or how I am applying it.

> [@Steve-Mcl](#):
>
> This might be a bug but its not really an issue.

Well, it is an issue if I am (or originally wasn't) using it to find where the problem is.  
If it says the wrong place, it doesn't help me understand where to look.

I don't like "telling tales out of school" (or something like that), @afelix has been of great help to me.  
In another thread [This one reply #13](https://discourse.nodered.org/t/subflows-inputs-and-outputs-not-matching-between-machines/15147/13)

_Yes, if this was just HTML you wouldn’t have to deal with `\` . But this is using HTML code inside a JavaScript string in the payload. For JavaScript strings you’ve to wrap the entire thing in quotes. It will see it as string from the first quote until the second. The lime is a string value in HTML, and in HTML you have to wrap attributes in double quotes. If your JavaScript string sees that double quote for the attribute it will consider it the end of the string. So you will have to “escape” the quotes in your HTML. You do that by putting a backslash before it._

So. . . . . that's how I read it.

I am (as I am famous for) missing something.

---

_[View the full topic](https://discourse.nodered.org/t/buttons-messages-topics-and-weird-things-with-messages/15220)._
