Canvas that send a parameter


Hi everyone, I have a GIS map in a canvas and I like to pass a parameter from the GIS map to the SmartForm. I that possible?

Thanks


2 replies

You can inject a javascript function (or use it inline in your javascript when the event fires). This works for me:
<script type=”text/javascript”>function writeToDataLabel(response) {$('span[name="Data Label Response"]').SFCLabel("option", "text", response);}</script>


 


Then you simply call writeToDataLabel("Use This Text"); in your javascript that responds to the actions on the map and writes the value to a data label called Data Label Response. You can of course make this more generic where it accepts the control name as an input as well if you have multiple controls you need to set.


 


If you're not familiar with using javascript in a SmartForm, the following external article will guide you through it:


Basic jQuery/Javascript samples in smart forms – Uncode K2 (wordpress.com)

I'm already using JS in the SmartForm, I will try your solution, thanks

Reply