Page 1 of 1

Form with javascript

Posted: 26 Mar 2017
by Kabelsatan
Hi

Im new to spform and sharepoint in general. I need some help with javascript.

I have a form with 3 fields, Url, Lat & Lon. My goal is to populate the Lat and Lon fields in an onChange event on the Url field.

Ive made this script, and added it in spform, but it doent seem to run

Testurl:
https://www.google.no/maps/place/Karmøy ... d5.2896453

I have tested the function outside of Sharepoint environment, and it runs and does what it should, in this example parse the url
and get the Lat, and Lon koordinates (59.2924316,5.2874566)

Code: Select all

var mySplitResult;
var mySplitSubResult;
var mylat;
var mylon;

fd.field(‘Url’).change(GetGeoLoc());

function(GetGeoLoc){
	var myString = fd.field(‘Url’).value();
	mySplitResult = myString.split("@");
	mySplitSubResult = mySplitResult[1].split(",");

	mylat = mySplitSubResult[0]);
	fd.field(‘Lat’).value(mylat);

	mylon = mySplitSubResult[1]);
	fd.field(‘Lon’).vakue(mylon);
 }  
any suggestions?

Chris D.

Re: Form with javascript

Posted: 26 Mar 2017
by Kabelsatan
SOLVED.

The Lat and Lon field had some gibberish internal names, not the Lat & Lon i was using

Chris D.