TransWikia.com

Is it possible to update a Freeform submission via twig?

Craft CMS Asked by Dan Letsche on December 2, 2020

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). The result page uses Smart Map to turn the search into a lat/lng 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

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?

One 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".

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.

Correct answer by Dan Letsche on December 2, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP