Skip to content

Commit 8516dd5

Browse files
authored
Update Documentation - lat/lon Utility functions (#304)
* Update Documentation - lat/lon Utility functions
1 parent 9e8d63c commit 8516dd5

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ There are some internal functions available to make interacting with Node-RED ea
723723

724724
- **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:
725725

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.
727727

728728
```
729729
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
732732
msg.payload = { command: { "contextmenu":menu } }
733733
```
734734

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+
735752
- **delMarker()** : takes the name of the marker as a parameter. In a popup this can be specified as `${name}` for dynamic substitution.
736753

737754
- **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

Comments
 (0)