Zh GoogleMap RSForm: Difference between revisions

From Documentation
Jump to navigation Jump to search
(Created page with "Before this time I didn't use forms, created by RSForm. In February 2017, user of my extension Phillip ask me to help with integration with RSForm! Pro. I checked RSFrom d...")
 
mNo edit summary
Line 23: Line 23:


[[File:RSForm form config.png]]
[[File:RSForm form config.png]]
After that lets go to see how it is displayed on site.
[[File:RSForm site form.png]]
Now lets come back to form configuration and do the integration.
1 - in Form properties, Section PHP Scripts, I added parsing '''Where''' field. In part '''Script''' called after form has been processed added this code
[code]
foreach($mappings as $mapping)
{
  $data = unserialize($mapping->data);
  $coords = explode(",", $_POST['form']['Where']);
  $lat = $coords[0];
  $lng = $coords[1];
  $data["latitude"] = strip_tags($lat);
  $data["longitude"] = strip_tags($lng);
  $mapping->data = serialize($data);
}
[/code]

Revision as of 12:05, 6 March 2017

Before this time I didn't use forms, created by RSForm.


In February 2017, user of my extension Phillip ask me to help with integration with RSForm! Pro.


I checked RSFrom docs and tutorials and understand that it is very easy.


This forms can do insert into any your database tables. And I store all data in tables.


The main task was - create placemark from filled form fields.


Lets do that.


First of all you have to configure your form, and create map field.


Look at image, the field Where is store position on map.


After that lets go to see how it is displayed on site.


Now lets come back to form configuration and do the integration.

1 - in Form properties, Section PHP Scripts, I added parsing Where field. In part Script called after form has been processed added this code [code] foreach($mappings as $mapping) {

 $data = unserialize($mapping->data);
 $coords = explode(",", $_POST['form']['Where']); 
 $lat = $coords[0];
 $lng = $coords[1];
 $data["latitude"] = strip_tags($lat);
 $data["longitude"] = strip_tags($lng);
 $mapping->data = serialize($data);

} [/code]