<p>Update: Solspace informed me this could be accomplished with a custom module and using a Freeform event, specifically this one:
<a href="https://docs.solspace.com/craft/freeform/v3/developer/submission-events.html#before-a-submission-is-submitted%22" rel="nofollow noreferrer">https://docs.solspace.com/craft/freeform/v3/developer/submission-events.html#before-a-submission-is-submitted&quot;</a>.</p>
<p>So, in my example, I will need to move my lat/lng logic into the custom module so it happens before the submission is submitted. Then, on the result page, grab the lat/lng from the submission data.</p>

CC BY-SA 4.0
2020-11-18T15:43:05.613Z
2020-11-18T15:43:05.613Z
Dan Letsche
<p>I'm making a google map feature where you type in a search and it drops a pin on the map (standard stuff).</p>
<p>I want to log all the searches for reporting. So, I'm using a Freeform form to collect the location search and display a map on the result page (<a href="https://docs.solspace.com/craft/freeform/v3/guides/submission-data-success.html" rel="nofollow noreferrer">using the token approach to get the submission info</a>). The result page uses <a href="https://www.doublesecretagency.com/plugins/smart-map/docs/front-end-address-lookup" rel="nofollow noreferrer">Smart Map to turn the search into a lat/lng</a> and then render the map. I've got that all working great.</p>
<p>What I'd also like to do, for reporting purposes, is to update the Freeform submission with the lat and lng that gets calculated on the result page.</p>
<p><a href="https://i.sstatic.net/V387w.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/V387w.png" alt="enter image description here" /></a></p>
<p>I haven't found a way to update a submission via twig in the docs. Is this possible? Or are there alternative approaches I should consider?</p>

<plugin-freeform><solspace>
Is it possible to update a Freeform submission via twig?
# Is it possible to update a Freeform submission via twig?

(Asked by: username_0 on 2020-11-07)

I'm making a google map feature where you type in a search and it drops a pin on the map (standard stuff).

I want to log all the searches for reporting. So, I'm using a Freeform form to collect the location search and display a map on the result page ([using the token approach to get the submission info](https://docs.solspace.com/craft/freeform/v3/guides/submission-data-success.html)). The result page uses [Smart Map to turn the search into a lat/lng](https://www.doublesecretagency.com/plugins/smart-map/docs/front-end-address-lookup) and then render the map. I've got that all working great.

What I'd also like to do, for reporting purposes, is to update the Freeform submission with the lat and lng that gets calculated on the result page.

[![enter image description here](https://i.sstatic.net/V387w.png)](https://i.sstatic.net/V387w.png)

I haven't found a way to update a submission via twig in the docs. Is this possible? Or are there alternative approaches I should consider?

**Tags:** plugin-freeform, solspace


---

## 1 answers

### Answer by username_0 on 2020-11-18. Score: 1 | Accepted answer

Update: Solspace informed me this could be accomplished with a custom module and using a Freeform event, specifically this one:
[https://docs.solspace.com/craft/freeform/v3/developer/submission-events.html#before-a-submission-is-submitted"](https://docs.solspace.com/craft/freeform/v3/developer/submission-events.html#before-a-submission-is-submitted%22).

So, in my example, I will need to move my lat/lng logic into the custom module so it happens before the submission is submitted. Then, on the result page, grab the lat/lng from the submission data.


---

