You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+18-1Lines changed: 18 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -723,7 +723,7 @@ There are some internal functions available to make interacting with Node-RED ea
723
723
724
724
-**addToForm()** : takes a property name value pair to add to a variable called `form`. When used with contextmenu feedback (above) you can set the feedback value to `"_form"` to substitute this accumulated value. This allows you to do things like `onBlur='addToForm(this.name,this.value)'` over several different fields in the menu and then use `feedback(this.name,"_form")` to submit them all at once. For example a simple multiple line form could be as per the example below:
725
725
726
-
Also if you wish to retain the values between separate openings of this form you can assign property names to the value field in the form `value="${foo}`, etc. These will then appear as part of an **value** property on the worldmap-in node message.
726
+
Retain Values - If you wish to retain the values between separate openings of this form you can assign property names to the value field in the form `value="${foo}`, etc. These will then appear as part of an **value** property on the worldmap-in node message.
727
727
728
728
```
729
729
var menu = 'Add some data <input name="foo" value="${foo}" onchange=\'addToForm(this.name,this.value)\'></input><br/>'
@@ -732,6 +732,23 @@ menu += '<button name="my_form" onclick=\'feedback(this.name,"_form","formAction
732
732
msg.payload = { command: { "contextmenu":menu } }
733
733
```
734
734
735
+
Custom Feedback Content - This exaple below shows how you can pass the latitude and longitude location value from the contextmenu popup when right clicking the map. You can use this method any other data you wish.
736
+
737
+
```
738
+
var menu ='<center><br/>';
739
+
menu += 'Add some data <input type="text" id="foo" placeholder="foo"><br/>';
740
+
menu += 'Add more data <input type="text" id="bar" placeholder="bar"><br/>';
741
+
menu += '<input type="button" value="Submit" onclick=';
742
+
menu += '\'feedback("myform",{';
743
+
menu += '"foo":document.getElementById("foo").value,';
744
+
menu += '"bar":document.getElementById("bar").value,';
745
+
menu += '"lat":rclk.lat.toFixed(12),';
746
+
menu += '"lon":rclk.lng.toFixed(12),';
747
+
menu += '},"formAction",true)\' > <br/><br/> ';
748
+
msg.payload = { command: { "contextmenu":menu } }
749
+
```
750
+
For a more detailed example flow using this method see: [Moving Icons Demo & Builder](https://github.com/dceejay/RedMap/blob/master/examples/Moving%20Icons%20Demo%20%26%20Builder.json)
751
+
735
752
-**delMarker()** : takes the name of the marker as a parameter. In a popup this can be specified as `${name}` for dynamic substitution.
736
753
737
754
-**editPoly()** : takes the name of the shape or line as a parameter. In a popup this can be specified as `${name}` for dynamic substitution.
0 commit comments