Hi Nick,
I just tested the code you provide and it worked perfectly! I want to thank you again for the awesome plug-in, and even better support!
I’m extended your code to capture ip address of the form submitter by using:
jQuery("#salesforce_w2l_lead_1 .w2linput#sf_IP_Address__c").val("<?php echo $_SERVER['REMOTE_ADDR']; ?>");
This works great.
But now I want to get even more fancy. I want to add form submitter region in the form.
I’m using this code I found online:
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
function geoTest() {
if (google.loader.ClientLocation) {
var latitude = google.loader.ClientLocation.latitude;
var longitude = google.loader.ClientLocation.longitude;
var city = google.loader.ClientLocation.address.city;
var country = google.loader.ClientLocation.address.country;
var country_code = google.loader.ClientLocation.address.country_code;
var region = google.loader.ClientLocation.address.region;
var text = 'Your Location<br /><br />Latitude: ' + latitude + '<br />Longitude: ' + longitude + '<br />City: ' + city + '<br />Country: ' + country + '<br />Country Code: ' + country_code + '<br />Region: ' + region;
} else {
var text = 'Google was not able to detect your location';
}
document.write(text);
}
geoTest();
</script>
But I can’t seem to call the function nor the variables using:
jQuery("#salesforce_w2l_lead_6 .w2linput#sf_Region__c").val(geoTest());
Love to hear your suggestions. And I hope my code above can help others.
Thank you,
Charles