Zh GoogleMap RSForm: Difference between revisions
mNo edit summary |
m (Admin moved page Zh GoogleMap RSForm! to Zh GoogleMap RSForm) |
||
(7 intermediate revisions by the same user not shown) | |||
Line 8: | Line 8: | ||
Forms can do insert into any your database tables. And I store all data in tables. | |||
Line 33: | Line 33: | ||
1 - in Form properties, Section PHP Scripts, I added parsing '''Where''' field. In part '''Script''' called after form has been processed added this code | 1 - in Form properties, Section PHP Scripts, I added parsing '''Where''' field. In part '''Script''' called after form has been processed added this code | ||
<pre> | |||
foreach($mappings as $mapping) | foreach($mappings as $mapping) | ||
{ | { | ||
Line 46: | Line 47: | ||
$mapping->data = serialize($data); | $mapping->data = serialize($data); | ||
} | } | ||
</pre> | |||
By this lines I parsed field '''Where''' into two properties: '''latitude''' and '''longitude''' | |||
And now go to the second part. | |||
2 – in Mapping section I created new one mapping, and as you can see I pass constants (you can change it to others) – map ID, title, description. | |||
For example description you can get from your other form field. | |||
Moreover, you have to check what values (database defaults) will be set to placemark’s properties: action by click, infowin content and the other. | |||
You can display map and new placemarks, and analyze what you expect to see and what you get. | |||
And by default placemarks is not published. You can also set this state in Mapping section. | |||
The final test integration mapping is | |||
<pre> | |||
INSERT INTO `f79f6_zhgooglemaps_markers` | |||
SET `id`='{last_insert_id}' | |||
, `title`='test' | |||
, `latitude`='{latitude}' | |||
, `longitude`='{longitude}' | |||
, `mapid`='1' | |||
, `openbaloon`='0' | |||
, `baloon`='3' | |||
, `icontype`='nurdle-icon' | |||
, `description`='Here I tried to find, but still there is no any found' | |||
, `published`='1' | |||
</pre> | |||
You can also add in mapping properties property to store user and date of placemark creation, and modify infowin content property to display it too. | |||
Now you can go to site and try to post data from your form, after that check placemarks in admin panel. |
Latest revision as of 08:19, 23 June 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.
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
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); }
By this lines I parsed field Where into two properties: latitude and longitude
And now go to the second part.
2 – in Mapping section I created new one mapping, and as you can see I pass constants (you can change it to others) – map ID, title, description.
For example description you can get from your other form field.
Moreover, you have to check what values (database defaults) will be set to placemark’s properties: action by click, infowin content and the other.
You can display map and new placemarks, and analyze what you expect to see and what you get. And by default placemarks is not published. You can also set this state in Mapping section.
The final test integration mapping is
INSERT INTO `f79f6_zhgooglemaps_markers` SET `id`='{last_insert_id}' , `title`='test' , `latitude`='{latitude}' , `longitude`='{longitude}' , `mapid`='1' , `openbaloon`='0' , `baloon`='3' , `icontype`='nurdle-icon' , `description`='Here I tried to find, but still there is no any found' , `published`='1'
You can also add in mapping properties property to store user and date of placemark creation, and modify infowin content property to display it too.
Now you can go to site and try to post data from your form, after that check placemarks in admin panel.