addForm working great.
But, there is always a but.
When adding the item back to the map. Having any custom values in the message stops the marker appearing on the map.
[
{
"id": "66862aab.3500c4",
"type": "tab",
"label": "map",
"disabled": false,
"info": ""
},
{
"id": "552ffcc3.ee4794",
"type": "ui_worldmap",
"z": "66862aab.3500c4",
"group": "6846504f.f1de98",
"order": 0,
"width": "27",
"height": "15",
"name": "dashmap",
"lat": "50.86928",
"lon": "-1.85308",
"zoom": "18",
"layer": "OSM",
"cluster": "",
"maxage": "",
"usermenu": "show",
"layers": "show",
"panit": "false",
"panlock": "false",
"zoomlock": "false",
"hiderightclick": "false",
"coords": "none",
"showgrid": "false",
"allowFileDrop": "false",
"path": "/dashmap",
"x": 840,
"y": 260,
"wires": []
},
{
"id": "37201464.9f850c",
"type": "debug",
"z": "66862aab.3500c4",
"name": "mapevents",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 450,
"y": 120,
"wires": []
},
{
"id": "cca8d55c.29be18",
"type": "function",
"z": "66862aab.3500c4",
"name": "setup-context-menu",
"func": "var menu = \"Name <input name='name' onchange='addToForm(this.name,this.value)'></input><br/>\"\nmenu += \"Type <input name='type' onchange='addToForm(this.name,this.value)'></input><br/>\"\nmenu += '<button name=\"my_form\" onclick=\\'feedback(this.name,\"$form\",null,true)\\'>Submit</button>'\n\nmsg.payload = {\n command: {\n \"contextmenu\": menu\n }\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 640,
"y": 220,
"wires": [
[
"552ffcc3.ee4794",
"482c23ba.23d9bc"
]
]
},
{
"id": "b316cde.8b8af3",
"type": "worldmap in",
"z": "66862aab.3500c4",
"name": "",
"path": "/dashmap",
"events": "all",
"x": 200,
"y": 220,
"wires": [
[
"37201464.9f850c",
"29c07caf.cd99e4"
]
]
},
{
"id": "29c07caf.cd99e4",
"type": "switch",
"z": "66862aab.3500c4",
"name": "",
"property": "payload.action",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "layer",
"vt": "str"
},
{
"t": "eq",
"v": "feedback",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 430,
"y": 220,
"wires": [
[
"cca8d55c.29be18"
],
[
"8ce3d134.c0e54"
]
]
},
{
"id": "482c23ba.23d9bc",
"type": "debug",
"z": "66862aab.3500c4",
"name": "setup-context-menu",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 880,
"y": 180,
"wires": []
},
{
"id": "99fd8519.4e607",
"type": "inject",
"z": "66862aab.3500c4",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "str",
"x": 210,
"y": 300,
"wires": [
[
"cca8d55c.29be18"
]
]
},
{
"id": "8ce3d134.c0e54",
"type": "function",
"z": "66862aab.3500c4",
"name": "process-feedback",
"func": "
var menu = \"Name <input name='name' onchange='addToForm(this.name,this.value)'></input><br/>\";
menu += \"Type <input name='type' onchange='addToForm(this.name,this.value)'></input><br/>\";menu += '<button name=\"my_form\" onclick=\\'feedback(this.name,\"$form\",null,true)\\'>Submit</button>';
var point = {
name: msg.payload.value.name,
label: msg.payload.value.name,
lat: msg.payload.lat,
lon: msg.payload.lon,
// type: msg.payload.value.type,
contextmenu: menu,
icon: \"car\",
iconColor:\"darkred\"
}
msg.payload = point;
return msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 450,
"y": 400,
"wires": [
[
"552ffcc3.ee4794",
"17d7efbb.c7a92"
]
]
},
{
"id": "17d7efbb.c7a92",
"type": "debug",
"z": "66862aab.3500c4",
"name": "process-feedback",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 870,
"y": 400,
"wires": []
},
{
"id": "6846504f.f1de98",
"type": "ui_group",
"name": "Site plan",
"tab": "ef10a04c.589f3",
"order": 1,
"disp": true,
"width": "30",
"collapse": false
},
{
"id": "ef10a04c.589f3",
"type": "ui_tab",
"name": "maptab",
"icon": "dashboard",
"disabled": false,
"hidden": false
}
]