Submit button won't show update on multiple browsers

I am trying to make a simple comment box for people on different computers to leave messages. When I submit a new comment the update shows on the local screen but not on a second computer. I am not sure what is wrong. The payload is correct but I think the submit is adding extra stuff to the object information. I have simulated data at inject nodes and they work on both screens. Please help!!

[{"id":"d52874de.c430c","type":"ui_template","z":"6973686c.70c13","group":"6fc8d493.05f97c","name":"SVG based template","order":6,"width":8,"height":7,"format":"<style>\n\n    #tex1 {\n        font-weight:bolder;\n        font-size: 14;\n        letter-spacing: 1px;\n        fill: white;\n    }\n    \n</style>\n\n\n\n<svg height=\"330\" width=\"430\" >\n\n<text id=\"tex1\" x=\"10\" y=\"30\" > {{msg.payload[0]}} </text>\n<text id=\"tex1\" x=\"10\" y=\"50\" > {{msg.payload[1]}} </text>\n<text id=\"tex1\" x=\"10\" y=\"70\" > {{msg.payload[2]}} </text>\n<text id=\"tex1\" x=\"10\" y=\"90\" > {{msg.payload[3]}} </text>\n<text id=\"tex1\" x=\"10\" y=\"110\" > {{msg.payload[4]}} </text>\n<text id=\"tex1\" x=\"10\" y=\"130\" > {{msg.payload[5]}} </text>\n<text id=\"tex1\" x=\"10\" y=\"150\" > {{msg.payload[6]}} </text>\n<text id=\"tex1\" x=\"10\" y=\"170\" > {{msg.payload[7]}} </text>\n<text id=\"tex1\" x=\"10\" y=\"190\" > {{msg.payload[8]}} </text>\n<text id=\"tex1\" x=\"10\" y=\"210\" > {{msg.payload[9]}} </text>\n<text id=\"tex1\" x=\"10\" y=\"230\" > {{msg.payload[10]}} </text>\n<text id=\"tex1\" x=\"10\" y=\"250\" > {{msg.payload[11]}} </text>\n<text id=\"tex1\" x=\"10\" y=\"270\" > {{msg.payload[12]}} </text>\n<text id=\"tex1\" x=\"10\" y=\"290\" > {{msg.payload[13]}} </text>\n<text id=\"tex1\" x=\"10\" y=\"310\" > {{msg.payload[14]}} </text>\n<text id=\"tex1\" x=\"10\" y=\"330\" > {{msg.payload[15]}} </text>\n\n\n</svg>\n\n\n","storeOutMessages":false,"fwdInMessages":false,"resendOnRefresh":false,"templateScope":"local","x":980,"y":340,"wires":[[]]},{"id":"52f29428.e81a94","type":"function","z":"6973686c.70c13","name":"Add word to scrolling table","func":"if(msg.topic === \"submit\"){\n    \nlet pay = msg.payload;\n\n// Read scrolling table from context\nlet sctab = flow.get(\"sctab\");\n\n// Modify scrolling table by adding msg.payload as first element\nlet size = sctab.unshift(pay);\n\n// Remove last element from scrolling table\nif (size >15) sctab.pop();\n\n// Update context for scrolling text\nflow.set(\"sctab\",sctab);\n\n// Shalow copy updated scrolling table to msg.payload\nmsg.payload = [...sctab];\nmsg.size = size;\n\n}\n\nif(msg.topic === \"name\"){\n    msg.payload = \"\";\n}\nif(msg.topic === \"comment\"){\n    msg.payload = \"\";\n}\n    \n    \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":720,"y":340,"wires":[["d52874de.c430c","5cf30f3c.3b5228"]]},{"id":"5cf30f3c.3b5228","type":"debug","z":"6973686c.70c13","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":930,"y":400,"wires":[]},{"id":"7478de18.9ede1","type":"function","z":"6973686c.70c13","name":"Create table in context","func":"let sctab = [];\nflow.set(\"sctab\", sctab);\nreturn msg;","outputs":"1","noerr":0,"initialize":"","finalize":"","x":420,"y":340,"wires":[["52f29428.e81a94"]]},{"id":"2888569a.6d3dca","type":"inject","z":"6973686c.70c13","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"},{"p":"payload.name","v":"","vt":"str"},{"p":"payload.comment","v":"","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":".1","topic":"","payload":"","payloadType":"str","x":90,"y":340,"wires":[["7478de18.9ede1","167fe4d2.4736e3","ec64f753.d6db1"]]},{"id":"d1e5a98c.3b04e","type":"inject","z":"6973686c.70c13","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"submit","payload":"Alfa - Hello World! This is a test message.","payloadType":"str","x":470,"y":180,"wires":[["52f29428.e81a94","5674771b.ff4918"]]},{"id":"aaf8f019.fecda8","type":"inject","z":"6973686c.70c13","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"submit","payload":"Bravo - Hello World! This is a test message.","payloadType":"str","x":470,"y":220,"wires":[["52f29428.e81a94"]]},{"id":"eed2c4a6.f00cf8","type":"inject","z":"6973686c.70c13","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"submit","payload":"Charlie - Hello World! This is a test message.","payloadType":"str","x":470,"y":260,"wires":[["52f29428.e81a94"]]},{"id":"133fc19e.daad56","type":"inject","z":"6973686c.70c13","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"submit","payload":"Delta - Hello World! This is a test message.","payloadType":"str","x":470,"y":300,"wires":[["52f29428.e81a94"]]},{"id":"167fe4d2.4736e3","type":"ui_text_input","z":"6973686c.70c13","name":"","label":"Name","tooltip":"","group":"6fc8d493.05f97c","order":3,"width":2,"height":1,"passthru":true,"mode":"text","delay":"0","topic":"name","x":290,"y":400,"wires":[["9558fdc1.7dd5f"]]},{"id":"ec64f753.d6db1","type":"ui_text_input","z":"6973686c.70c13","name":"","label":"Comment","tooltip":"","group":"6fc8d493.05f97c","order":4,"width":4,"height":1,"passthru":true,"mode":"text","delay":"0","topic":"comment","x":280,"y":440,"wires":[["9558fdc1.7dd5f"]]},{"id":"4da4f1f1.650b1","type":"ui_button","z":"6973686c.70c13","name":"","group":"6fc8d493.05f97c","order":5,"width":2,"height":1,"passthru":false,"label":"Submit","tooltip":"","color":"black","bgcolor":"white","icon":"fa-comment","payload":"","payloadType":"str","topic":"submit","x":290,"y":480,"wires":[["9558fdc1.7dd5f"]]},{"id":"9558fdc1.7dd5f","type":"function","z":"6973686c.70c13","name":"","func":"var nameinput = context.get(\"nameinput\") || \"\";\nvar commentinput = context.get(\"commentinput\") || \"\";\nvar submitinput = nameinput + \" - \" + commentinput;\n\n\n\nif(msg.topic === \"name\"){\n    nameinput = msg.payload;\n    context.set(\"nameinput\",nameinput);\n}\n\nif(msg.topic === \"comment\"){\n    commentinput = msg.payload;\n    context.set(\"commentinput\",commentinput);\n}\n\nif(msg.topic === \"submit\"){\n    msg.payload = submitinput;\n    }\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":460,"y":420,"wires":[["19365126.a72c47","52f29428.e81a94"]]},{"id":"19365126.a72c47","type":"debug","z":"6973686c.70c13","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":630,"y":420,"wires":[]},{"id":"5674771b.ff4918","type":"debug","z":"6973686c.70c13","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":670,"y":180,"wires":[]},{"id":"6fc8d493.05f97c","type":"ui_group","z":"","name":"Group 1","tab":"a50105e5.af10d8","order":1,"disp":false,"width":8,"collapse":false},{"id":"a50105e5.af10d8","type":"ui_tab","z":"","name":"Comment Box","icon":"fa-comments","order":2,"disabled":false,"hidden":false}]

You may need to tick this option at the bottom of the node.

I have fallen for this trap a few times myself.

OK, I tried setting this option but still doesn't work.

image

You may need to force refresh the other machines pages.

caches can be painful with this kind of problem.

Shift button and press the reload button - I think.

so you want all browsers to see the same ?
If so then I think you need to delete the msg.socketid property as that routes the message back to the originating sender.

When I refresh the other pages the comments show up.

OK, I was suspecting that might me the case because when I use the inject nodes they show up on all screens with no problem and they don't have the msg.socketid in the debug. How can they be taken out?

OK, I used the change-delete on the msg.socketid. That worked!! Thank you for your help!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.